diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticCollection.cs index 7725d29db747..ad78e7a47a90 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiDiagnosticCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiDiagnostics() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiDiagnostics.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiDiagnostics.json // this example is just showing the usage of "ApiDiagnostic_ListByService" 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 @@ -31,17 +31,17 @@ public async Task GetAll_ApiManagementListApiDiagnostics() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "echo-api"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiDiagnosticResource - ApiDiagnosticCollection collection = api.GetApiDiagnostics(); + ApiDiagnosticCollection collection = serviceApi.GetApiDiagnostics(); // invoke the operation and iterate over the result await foreach (ApiDiagnosticResource item in collection.GetAllAsync()) @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListApiDiagnostics() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiDiagnostic.json // this example is just showing the usage of "ApiDiagnostic_Get" 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 @@ -69,17 +69,17 @@ public async Task Get_ApiManagementGetApiDiagnostic() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiDiagnosticResource - ApiDiagnosticCollection collection = api.GetApiDiagnostics(); + ApiDiagnosticCollection collection = serviceApi.GetApiDiagnostics(); // invoke the operation string diagnosticId = "applicationinsights"; @@ -97,7 +97,7 @@ public async Task Get_ApiManagementGetApiDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiDiagnostic.json // this example is just showing the usage of "ApiDiagnostic_Get" 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 @@ -105,17 +105,17 @@ public async Task Exists_ApiManagementGetApiDiagnostic() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiDiagnosticResource - ApiDiagnosticCollection collection = api.GetApiDiagnostics(); + ApiDiagnosticCollection collection = serviceApi.GetApiDiagnostics(); // invoke the operation string diagnosticId = "applicationinsights"; @@ -129,7 +129,7 @@ public async Task Exists_ApiManagementGetApiDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiDiagnostic.json // this example is just showing the usage of "ApiDiagnostic_Get" 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 @@ -137,17 +137,17 @@ public async Task GetIfExists_ApiManagementGetApiDiagnostic() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiDiagnosticResource - ApiDiagnosticCollection collection = api.GetApiDiagnostics(); + ApiDiagnosticCollection collection = serviceApi.GetApiDiagnostics(); // invoke the operation string diagnosticId = "applicationinsights"; @@ -173,7 +173,7 @@ public async Task GetIfExists_ApiManagementGetApiDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -181,17 +181,17 @@ public async Task CreateOrUpdate_ApiManagementCreateApiDiagnostic() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiDiagnosticResource - ApiDiagnosticCollection collection = api.GetApiDiagnostics(); + ApiDiagnosticCollection collection = serviceApi.GetApiDiagnostics(); // invoke the operation string diagnosticId = "applicationinsights"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticResource.cs index f2e542d6377c..47a4c6c91730 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiDiagnosticResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiDiagnosticResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiDiagnostic.json // this example is just showing the usage of "ApiDiagnostic_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadApiDiagnostic() // this example assumes you already have this ApiDiagnosticResource created on azure // for more information of creating ApiDiagnosticResource, please refer to the document of ApiDiagnosticResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadApiDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiDiagnostic.json // this example is just showing the usage of "ApiDiagnostic_Get" 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 @@ -62,7 +62,7 @@ public async Task Get_ApiManagementGetApiDiagnostic() // this example assumes you already have this ApiDiagnosticResource created on azure // for more information of creating ApiDiagnosticResource, please refer to the document of ApiDiagnosticResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; @@ -85,7 +85,7 @@ public async Task Get_ApiManagementGetApiDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateApiDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateApiDiagnostic.json // this example is just showing the usage of "ApiDiagnostic_Update" 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 @@ -95,7 +95,7 @@ public async Task Update_ApiManagementUpdateApiDiagnostic() // this example assumes you already have this ApiDiagnosticResource created on azure // for more information of creating ApiDiagnosticResource, please refer to the document of ApiDiagnosticResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "echo-api"; @@ -167,7 +167,7 @@ public async Task Update_ApiManagementUpdateApiDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiDiagnostic.json // this example is just showing the usage of "ApiDiagnostic_Delete" 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 @@ -177,7 +177,7 @@ public async Task Delete_ApiManagementDeleteApiDiagnostic() // this example assumes you already have this ApiDiagnosticResource created on azure // for more information of creating ApiDiagnosticResource, please refer to the document of ApiDiagnosticResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentCollection.cs index 5d721e68821a..182cc00a1c67 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiIssueAttachmentCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiIssueAttachments() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiIssueAttachments.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiIssueAttachments.json // this example is just showing the usage of "ApiIssueAttachment_ListByService" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListApiIssueAttachments() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListApiIssueAttachments() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiIssueAttachment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueAttachment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssueAttachment.json // this example is just showing the usage of "ApiIssueAttachment_Get" 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 @@ -71,7 +71,7 @@ public async Task Get_ApiManagementGetApiIssueAttachment() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -98,7 +98,7 @@ public async Task Get_ApiManagementGetApiIssueAttachment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiIssueAttachment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueAttachment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssueAttachment.json // this example is just showing the usage of "ApiIssueAttachment_Get" 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 @@ -108,7 +108,7 @@ public async Task Exists_ApiManagementGetApiIssueAttachment() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -131,7 +131,7 @@ public async Task Exists_ApiManagementGetApiIssueAttachment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiIssueAttachment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueAttachment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssueAttachment.json // this example is just showing the usage of "ApiIssueAttachment_Get" 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 @@ -141,7 +141,7 @@ public async Task GetIfExists_ApiManagementGetApiIssueAttachment() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -176,7 +176,7 @@ public async Task GetIfExists_ApiManagementGetApiIssueAttachment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiIssueAttachment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssueAttachment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -186,7 +186,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiIssueAttachment() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentResource.cs index 346dcfc1e63a..0a9a229bfcc4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueAttachmentResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiIssueAttachmentResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiIssueAttachment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiIssueAttachment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiIssueAttachment.json // this example is just showing the usage of "ApiIssueAttachment_GetEntityTag" 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 @@ -32,7 +32,7 @@ public async Task GetEntityTag_ApiManagementHeadApiIssueAttachment() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadApiIssueAttachment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiIssueAttachment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueAttachment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssueAttachment.json // this example is just showing the usage of "ApiIssueAttachment_Get" 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 @@ -62,7 +62,7 @@ public async Task Get_ApiManagementGetApiIssueAttachment() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -86,7 +86,7 @@ public async Task Get_ApiManagementGetApiIssueAttachment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateApiIssueAttachment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssueAttachment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -96,7 +96,7 @@ public async Task Update_ApiManagementCreateApiIssueAttachment() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; @@ -127,7 +127,7 @@ public async Task Update_ApiManagementCreateApiIssueAttachment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiIssueAttachment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiIssueAttachment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiIssueAttachment.json // this example is just showing the usage of "ApiIssueAttachment_Delete" 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 @@ -137,7 +137,7 @@ public async Task Delete_ApiManagementDeleteApiIssueAttachment() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCollection.cs index 4ac49f237fe4..03a2e2993f17 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiIssueCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiIssues() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiIssues.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiIssues.json // this example is just showing the usage of "ApiIssue_ListByService" 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 @@ -31,17 +31,17 @@ public async Task GetAll_ApiManagementListApiIssues() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiIssueResource - ApiIssueCollection collection = api.GetApiIssues(); + ApiIssueCollection collection = serviceApi.GetApiIssues(); // invoke the operation and iterate over the result await foreach (ApiIssueResource item in collection.GetAllAsync()) @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListApiIssues() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssue.json // this example is just showing the usage of "ApiIssue_Get" 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 @@ -69,17 +69,17 @@ public async Task Get_ApiManagementGetApiIssue() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiIssueResource - ApiIssueCollection collection = api.GetApiIssues(); + ApiIssueCollection collection = serviceApi.GetApiIssues(); // invoke the operation string issueId = "57d2ef278aa04f0ad01d6cdc"; @@ -97,7 +97,7 @@ public async Task Get_ApiManagementGetApiIssue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssue.json // this example is just showing the usage of "ApiIssue_Get" 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 @@ -105,17 +105,17 @@ public async Task Exists_ApiManagementGetApiIssue() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiIssueResource - ApiIssueCollection collection = api.GetApiIssues(); + ApiIssueCollection collection = serviceApi.GetApiIssues(); // invoke the operation string issueId = "57d2ef278aa04f0ad01d6cdc"; @@ -129,7 +129,7 @@ public async Task Exists_ApiManagementGetApiIssue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssue.json // this example is just showing the usage of "ApiIssue_Get" 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 @@ -137,17 +137,17 @@ public async Task GetIfExists_ApiManagementGetApiIssue() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiIssueResource - ApiIssueCollection collection = api.GetApiIssues(); + ApiIssueCollection collection = serviceApi.GetApiIssues(); // invoke the operation string issueId = "57d2ef278aa04f0ad01d6cdc"; @@ -173,7 +173,7 @@ public async Task GetIfExists_ApiManagementGetApiIssue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -181,17 +181,17 @@ public async Task CreateOrUpdate_ApiManagementCreateApiIssue() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiIssueResource - ApiIssueCollection collection = api.GetApiIssues(); + ApiIssueCollection collection = serviceApi.GetApiIssues(); // invoke the operation string issueId = "57d2ef278aa04f0ad01d6cdc"; @@ -201,7 +201,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiIssue() State = IssueState.Open, Title = "New API issue", Description = "New API issue description", - UserId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), + UserId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, issueId, data); ApiIssueResource result = lro.Value; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentCollection.cs index a7d901dc8d7c..1929453086ce 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiIssueCommentCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiIssueComments() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiIssueComments.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiIssueComments.json // this example is just showing the usage of "ApiIssueComment_ListByService" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListApiIssueComments() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListApiIssueComments() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiIssueComment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueComment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssueComment.json // this example is just showing the usage of "ApiIssueComment_Get" 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 @@ -71,7 +71,7 @@ public async Task Get_ApiManagementGetApiIssueComment() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -98,7 +98,7 @@ public async Task Get_ApiManagementGetApiIssueComment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiIssueComment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueComment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssueComment.json // this example is just showing the usage of "ApiIssueComment_Get" 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 @@ -108,7 +108,7 @@ public async Task Exists_ApiManagementGetApiIssueComment() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -131,7 +131,7 @@ public async Task Exists_ApiManagementGetApiIssueComment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiIssueComment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueComment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssueComment.json // this example is just showing the usage of "ApiIssueComment_Get" 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 @@ -141,7 +141,7 @@ public async Task GetIfExists_ApiManagementGetApiIssueComment() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -176,7 +176,7 @@ public async Task GetIfExists_ApiManagementGetApiIssueComment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiIssueComment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssueComment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -186,7 +186,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiIssueComment() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; @@ -203,7 +203,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiIssueComment() { Text = "Issue comment.", CreatedOn = DateTimeOffset.Parse("2018-02-01T22:21:20.467Z"), - UserId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), + UserId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, commentId, data); ApiIssueCommentResource result = lro.Value; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentResource.cs index 7735a6678998..17b84e684cbd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueCommentResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiIssueCommentResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiIssueComment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiIssueComment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiIssueComment.json // this example is just showing the usage of "ApiIssueComment_GetEntityTag" 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 @@ -32,7 +32,7 @@ public async Task GetEntityTag_ApiManagementHeadApiIssueComment() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadApiIssueComment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiIssueComment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssueComment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssueComment.json // this example is just showing the usage of "ApiIssueComment_Get" 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 @@ -62,7 +62,7 @@ public async Task Get_ApiManagementGetApiIssueComment() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -86,7 +86,7 @@ public async Task Get_ApiManagementGetApiIssueComment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateApiIssueComment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiIssueComment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -96,7 +96,7 @@ public async Task Update_ApiManagementCreateApiIssueComment() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; @@ -110,7 +110,7 @@ public async Task Update_ApiManagementCreateApiIssueComment() { Text = "Issue comment.", CreatedOn = DateTimeOffset.Parse("2018-02-01T22:21:20.467Z"), - UserId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), + UserId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"), }; ArmOperation lro = await apiIssueComment.UpdateAsync(WaitUntil.Completed, data); ApiIssueCommentResource result = lro.Value; @@ -127,7 +127,7 @@ public async Task Update_ApiManagementCreateApiIssueComment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiIssueComment() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiIssueComment.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiIssueComment.json // this example is just showing the usage of "ApiIssueComment_Delete" 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 @@ -137,7 +137,7 @@ public async Task Delete_ApiManagementDeleteApiIssueComment() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueResource.cs index d1900778096d..34666b72857e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiIssueResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiIssueResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiIssue.json // this example is just showing the usage of "ApiIssue_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadApiIssue() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadApiIssue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiIssue.json // this example is just showing the usage of "ApiIssue_Get" 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 @@ -62,7 +62,7 @@ public async Task Get_ApiManagementGetApiIssue() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; @@ -85,7 +85,7 @@ public async Task Get_ApiManagementGetApiIssue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateApiIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateApiIssue.json // this example is just showing the usage of "ApiIssue_Update" 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 @@ -95,7 +95,7 @@ public async Task Update_ApiManagementUpdateApiIssue() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; @@ -123,7 +123,7 @@ public async Task Update_ApiManagementUpdateApiIssue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiIssue.json // this example is just showing the usage of "ApiIssue_Delete" 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 @@ -133,7 +133,7 @@ public async Task Delete_ApiManagementDeleteApiIssue() // this example assumes you already have this ApiIssueResource created on azure // for more information of creating ApiIssueResource, please refer to the document of ApiIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerCollection.cs index 13f8dfc7b3e3..eaf2b284cda8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementAuthorizationServerCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListAuthorizationServers() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListAuthorizationServers.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListAuthorizationServers.json // this example is just showing the usage of "AuthorizationServer_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListAuthorizationServers() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListAuthorizationServers() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetAuthorizationServer() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetAuthorizationServer.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationServer.json // this example is just showing the usage of "AuthorizationServer_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetAuthorizationServer() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetAuthorizationServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetAuthorizationServer() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetAuthorizationServer.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationServer.json // this example is just showing the usage of "AuthorizationServer_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetAuthorizationServer() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetAuthorizationServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetAuthorizationServer() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetAuthorizationServer.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationServer.json // this example is just showing the usage of "AuthorizationServer_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetAuthorizationServer() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetAuthorizationServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateAuthorizationServer() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateAuthorizationServer.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateAuthorizationServer() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -207,6 +207,8 @@ public async Task CreateOrUpdate_ApiManagementCreateAuthorizationServer() ResourceOwnerUsername = "un", ResourceOwnerPassword = "pwd", DisplayName = "test2", + UseInTestConsole = false, + UseInApiDocumentation = true, ClientRegistrationEndpoint = "https://www.contoso.com/apps", AuthorizationEndpoint = "https://www.contoso.com/oauth2/auth", GrantTypes = diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerResource.cs index d93628279dd6..7ffc0c0b2865 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementAuthorizationServerResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementAuthorizationServerResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadAuthorizationServer() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadAuthorizationServer.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadAuthorizationServer.json // this example is just showing the usage of "AuthorizationServer_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadAuthorizationServer() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string authsid = "newauthServer2"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadAuthorizationServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetAuthorizationServer() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetAuthorizationServer.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationServer.json // this example is just showing the usage of "AuthorizationServer_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetAuthorizationServer() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string authsid = "newauthServer2"; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetAuthorizationServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateAuthorizationServer() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateAuthorizationServer.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateAuthorizationServer.json // this example is just showing the usage of "AuthorizationServer_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateAuthorizationServer() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string authsid = "newauthServer"; @@ -104,6 +104,8 @@ public async Task Update_ApiManagementUpdateAuthorizationServer() ETag ifMatch = new ETag("*"); ApiManagementAuthorizationServerPatch patch = new ApiManagementAuthorizationServerPatch() { + UseInTestConsole = false, + UseInApiDocumentation = true, ClientId = "update", ClientSecret = "updated", }; @@ -121,7 +123,7 @@ public async Task Update_ApiManagementUpdateAuthorizationServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteAuthorizationServer() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteAuthorizationServer.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteAuthorizationServer.json // this example is just showing the usage of "AuthorizationServer_Delete" 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 @@ -131,7 +133,7 @@ public async Task Delete_ApiManagementDeleteAuthorizationServer() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string authsid = "newauthServer2"; @@ -150,7 +152,7 @@ public async Task Delete_ApiManagementDeleteAuthorizationServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSecrets_ApiManagementAuthorizationServerListSecrets() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementAuthorizationServerListSecrets.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -160,7 +162,7 @@ public async Task GetSecrets_ApiManagementAuthorizationServerListSecrets() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string authsid = "newauthServer2"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendCollection.cs index 050c204923df..229bde85c871 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementBackendCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListBackends() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListBackends.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListBackends.json // this example is just showing the usage of "Backend_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListBackends() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListBackends() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetBackend() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetBackend.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetBackend.json // this example is just showing the usage of "Backend_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetBackend() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetBackend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetBackend() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetBackend.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetBackend.json // this example is just showing the usage of "Backend_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetBackend() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetBackend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetBackend() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetBackend.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetBackend.json // this example is just showing the usage of "Backend_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetBackend() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetBackend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateBackendProxyBackend() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateBackendProxyBackend.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateBackendProxyBackend() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -239,7 +239,7 @@ public async Task CreateOrUpdate_ApiManagementCreateBackendProxyBackend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateBackendServiceFabric() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateBackendServiceFabric.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -249,7 +249,7 @@ public async Task CreateOrUpdate_ApiManagementCreateBackendServiceFabric() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -268,7 +268,7 @@ public async Task CreateOrUpdate_ApiManagementCreateBackendServiceFabric() "https://somecluster.com" }) { - ClientCertificateId = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1", + ClientCertificateId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1", MaxPartitionResolutionRetries = 5, ServerX509Names = { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendResource.cs index 72771603ee9d..88a07bc97cc5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementBackendResource.cs @@ -24,7 +24,7 @@ public partial class Sample_ApiManagementBackendResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadBackend() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadBackend.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadBackend.json // this example is just showing the usage of "Backend_GetEntityTag" 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 @@ -34,7 +34,7 @@ public async Task GetEntityTag_ApiManagementHeadBackend() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string backendId = "sfbackend"; @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadBackend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetBackend() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetBackend.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetBackend.json // this example is just showing the usage of "Backend_Get" 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 @@ -62,7 +62,7 @@ public async Task Get_ApiManagementGetBackend() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string backendId = "sfbackend"; @@ -84,7 +84,7 @@ public async Task Get_ApiManagementGetBackend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateBackend() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateBackend.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateBackend.json // this example is just showing the usage of "Backend_Update" 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 @@ -94,7 +94,7 @@ public async Task Update_ApiManagementUpdateBackend() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string backendId = "proxybackend"; @@ -126,7 +126,7 @@ public async Task Update_ApiManagementUpdateBackend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteBackend() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteBackend.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteBackend.json // this example is just showing the usage of "Backend_Delete" 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 @@ -136,7 +136,7 @@ public async Task Delete_ApiManagementDeleteBackend() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string backendId = "sfbackend"; @@ -155,7 +155,7 @@ public async Task Delete_ApiManagementDeleteBackend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Reconnect_ApiManagementBackendReconnect() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackendReconnect.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -165,7 +165,7 @@ public async Task Reconnect_ApiManagementBackendReconnect() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string backendId = "proxybackend"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheCollection.cs index 02f39d1e2a7a..df4ed307aa45 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementCacheCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListCaches() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListCaches.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListCaches.json // this example is just showing the usage of "Cache_ListByService" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListCaches() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -59,7 +59,7 @@ public async Task GetAll_ApiManagementListCaches() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetCache() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCache.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCache.json // this example is just showing the usage of "Cache_Get" 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 @@ -69,7 +69,7 @@ public async Task Get_ApiManagementGetCache() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -94,7 +94,7 @@ public async Task Get_ApiManagementGetCache() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetCache() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCache.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCache.json // this example is just showing the usage of "Cache_Get" 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 @@ -104,7 +104,7 @@ public async Task Exists_ApiManagementGetCache() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -125,7 +125,7 @@ public async Task Exists_ApiManagementGetCache() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetCache() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCache.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCache.json // this example is just showing the usage of "Cache_Get" 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 @@ -135,7 +135,7 @@ public async Task GetIfExists_ApiManagementGetCache() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -168,7 +168,7 @@ public async Task GetIfExists_ApiManagementGetCache() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateCache() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCache.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -178,7 +178,7 @@ public async Task CreateOrUpdate_ApiManagementCreateCache() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -194,7 +194,7 @@ public async Task CreateOrUpdate_ApiManagementCreateCache() 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/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1"), + ResourceUri = new Uri("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1"), }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, cacheId, data); ApiManagementCacheResource result = lro.Value; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheResource.cs index dc93c3b7bdf2..29dc4e24c0e0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCacheResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementCacheResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadCache() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadCache.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadCache.json // this example is just showing the usage of "Cache_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadCache() // this example assumes you already have this ApiManagementCacheResource created on azure // for more information of creating ApiManagementCacheResource, please refer to the document of ApiManagementCacheResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string cacheId = "default"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadCache() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetCache() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCache.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCache.json // this example is just showing the usage of "Cache_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetCache() // this example assumes you already have this ApiManagementCacheResource created on azure // for more information of creating ApiManagementCacheResource, please refer to the document of ApiManagementCacheResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string cacheId = "c1"; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetCache() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateCache() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateCache.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateCache.json // this example is just showing the usage of "Cache_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateCache() // this example assumes you already have this ApiManagementCacheResource created on azure // for more information of creating ApiManagementCacheResource, please refer to the document of ApiManagementCacheResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string cacheId = "c1"; @@ -120,7 +120,7 @@ public async Task Update_ApiManagementUpdateCache() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteCache() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteCache.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteCache.json // this example is just showing the usage of "Cache_Delete" 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 @@ -130,7 +130,7 @@ public async Task Delete_ApiManagementDeleteCache() // this example assumes you already have this ApiManagementCacheResource created on azure // for more information of creating ApiManagementCacheResource, please refer to the document of ApiManagementCacheResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string cacheId = "southindia"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateCollection.cs index 8493cd23adde..6cdba46fcedb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementCertificateCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListCertificates() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListCertificates.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListCertificates.json // this example is just showing the usage of "Certificate_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListCertificates() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListCertificates() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetCertificate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCertificate.json // this example is just showing the usage of "Certificate_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetCertificate() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetCertificate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCertificate.json // this example is just showing the usage of "Certificate_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetCertificate() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetCertificate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCertificate.json // this example is just showing the usage of "Certificate_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetCertificate() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetCertificateWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificateWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCertificateWithKeyVault.json // this example is just showing the usage of "Certificate_Get" 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 @@ -179,7 +179,7 @@ public async Task Get_ApiManagementGetCertificateWithKeyVault() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -204,7 +204,7 @@ public async Task Get_ApiManagementGetCertificateWithKeyVault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetCertificateWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificateWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCertificateWithKeyVault.json // this example is just showing the usage of "Certificate_Get" 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 @@ -214,7 +214,7 @@ public async Task Exists_ApiManagementGetCertificateWithKeyVault() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -235,7 +235,7 @@ public async Task Exists_ApiManagementGetCertificateWithKeyVault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetCertificateWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificateWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCertificateWithKeyVault.json // this example is just showing the usage of "Certificate_Get" 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 @@ -245,7 +245,7 @@ public async Task GetIfExists_ApiManagementGetCertificateWithKeyVault() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -278,7 +278,7 @@ public async Task GetIfExists_ApiManagementGetCertificateWithKeyVault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateCertificate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCertificate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -288,7 +288,7 @@ public async Task CreateOrUpdate_ApiManagementCreateCertificate() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -319,7 +319,7 @@ public async Task CreateOrUpdate_ApiManagementCreateCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateCertificateWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCertificateWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -329,7 +329,7 @@ public async Task CreateOrUpdate_ApiManagementCreateCertificateWithKeyVault() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateResource.cs index ecf23879b197..7e787aab3856 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementCertificateResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementCertificateResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadCertificate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadCertificate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadCertificate.json // this example is just showing the usage of "Certificate_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadCertificate() // this example assumes you already have this ApiManagementCertificateResource created on azure // for more information of creating ApiManagementCertificateResource, please refer to the document of ApiManagementCertificateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string certificateId = "templateCert1"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetCertificate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCertificate.json // this example is just showing the usage of "Certificate_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetCertificate() // this example assumes you already have this ApiManagementCertificateResource created on azure // for more information of creating ApiManagementCertificateResource, please refer to the document of ApiManagementCertificateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string certificateId = "templateCert1"; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetCertificateWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetCertificateWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetCertificateWithKeyVault.json // this example is just showing the usage of "Certificate_Get" 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 @@ -93,7 +93,7 @@ public async Task Get_ApiManagementGetCertificateWithKeyVault() // this example assumes you already have this ApiManagementCertificateResource created on azure // for more information of creating ApiManagementCertificateResource, please refer to the document of ApiManagementCertificateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string certificateId = "templateCertkv"; @@ -115,7 +115,7 @@ public async Task Get_ApiManagementGetCertificateWithKeyVault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateCertificate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCertificate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -125,7 +125,7 @@ public async Task Update_ApiManagementCreateCertificate() // this example assumes you already have this ApiManagementCertificateResource created on azure // for more information of creating ApiManagementCertificateResource, please refer to the document of ApiManagementCertificateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string certificateId = "tempcert"; @@ -153,7 +153,7 @@ public async Task Update_ApiManagementCreateCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateCertificateWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateCertificateWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -163,7 +163,7 @@ public async Task Update_ApiManagementCreateCertificateWithKeyVault() // this example assumes you already have this ApiManagementCertificateResource created on azure // for more information of creating ApiManagementCertificateResource, please refer to the document of ApiManagementCertificateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string certificateId = "templateCertkv"; @@ -194,7 +194,7 @@ public async Task Update_ApiManagementCreateCertificateWithKeyVault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteCertificate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteCertificate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteCertificate.json // this example is just showing the usage of "Certificate_Delete" 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 @@ -204,7 +204,7 @@ public async Task Delete_ApiManagementDeleteCertificate() // this example assumes you already have this ApiManagementCertificateResource created on azure // for more information of creating ApiManagementCertificateResource, please refer to the document of ApiManagementCertificateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string certificateId = "tempcert"; @@ -223,7 +223,7 @@ public async Task Delete_ApiManagementDeleteCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RefreshSecret_ApiManagementRefreshCertificate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementRefreshCertificate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementRefreshCertificate.json // this example is just showing the usage of "Certificate_RefreshSecret" 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 @@ -233,7 +233,7 @@ public async Task RefreshSecret_ApiManagementRefreshCertificate() // this example assumes you already have this ApiManagementCertificateResource created on azure // for more information of creating ApiManagementCertificateResource, please refer to the document of ApiManagementCertificateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string certificateId = "templateCertkv"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceCollection.cs index 47656bda9ea9..dc142c24b88c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementDeletedServiceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetDeletedServiceByName() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDeletedServiceByName.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDeletedServiceByName.json // this example is just showing the usage of "DeletedServices_GetByName" 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 @@ -33,7 +33,7 @@ public async Task Get_ApiManagementGetDeletedServiceByName() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); @@ -57,7 +57,7 @@ public async Task Get_ApiManagementGetDeletedServiceByName() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetDeletedServiceByName() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDeletedServiceByName.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDeletedServiceByName.json // this example is just showing the usage of "DeletedServices_GetByName" 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 @@ -67,7 +67,7 @@ public async Task Exists_ApiManagementGetDeletedServiceByName() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); @@ -87,7 +87,7 @@ public async Task Exists_ApiManagementGetDeletedServiceByName() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetDeletedServiceByName() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDeletedServiceByName.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDeletedServiceByName.json // this example is just showing the usage of "DeletedServices_GetByName" 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 @@ -97,7 +97,7 @@ public async Task GetIfExists_ApiManagementGetDeletedServiceByName() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceResource.cs index d17b4c5cb516..0d25d3a7507b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDeletedServiceResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementDeletedServiceResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetApiManagementDeletedServices_ApiManagementDeletedServicesListBySubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletedServicesListBySubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeletedServicesListBySubscription.json // this example is just showing the usage of "DeletedServices_ListBySubscription" 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 @@ -33,7 +33,7 @@ public async Task GetApiManagementDeletedServices_ApiManagementDeletedServicesLi // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); @@ -55,7 +55,7 @@ public async Task GetApiManagementDeletedServices_ApiManagementDeletedServicesLi [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetDeletedServiceByName() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDeletedServiceByName.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDeletedServiceByName.json // this example is just showing the usage of "DeletedServices_GetByName" 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 @@ -65,7 +65,7 @@ public async Task Get_ApiManagementGetDeletedServiceByName() // this example assumes you already have this ApiManagementDeletedServiceResource created on azure // for more information of creating ApiManagementDeletedServiceResource, please refer to the document of ApiManagementDeletedServiceResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; AzureLocation location = new AzureLocation("westus"); string serviceName = "apimService3"; ResourceIdentifier apiManagementDeletedServiceResourceId = ApiManagementDeletedServiceResource.CreateResourceIdentifier(subscriptionId, location, serviceName); @@ -86,7 +86,7 @@ public async Task Get_ApiManagementGetDeletedServiceByName() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeletedServicesPurge() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletedServicesPurge.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeletedServicesPurge.json // this example is just showing the usage of "DeletedServices_Purge" 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 @@ -96,7 +96,7 @@ public async Task Delete_ApiManagementDeletedServicesPurge() // this example assumes you already have this ApiManagementDeletedServiceResource created on azure // for more information of creating ApiManagementDeletedServiceResource, please refer to the document of ApiManagementDeletedServiceResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; AzureLocation location = new AzureLocation("westus"); string serviceName = "apimService3"; ResourceIdentifier apiManagementDeletedServiceResourceId = ApiManagementDeletedServiceResource.CreateResourceIdentifier(subscriptionId, location, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticCollection.cs index ebbc3b7fcc77..7a480c0b0041 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementDiagnosticCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListDiagnostics() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListDiagnostics.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListDiagnostics.json // this example is just showing the usage of "Diagnostic_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListDiagnostics() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListDiagnostics() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDiagnostic.json // this example is just showing the usage of "Diagnostic_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetDiagnostic() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDiagnostic.json // this example is just showing the usage of "Diagnostic_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetDiagnostic() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDiagnostic.json // this example is just showing the usage of "Diagnostic_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetDiagnostic() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateDiagnostic.json // this example is just showing the usage of "Diagnostic_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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateDiagnostic() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticResource.cs index 4354a896c89e..fa559a2ac1b2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementDiagnosticResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementDiagnosticResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadDiagnostic.json // this example is just showing the usage of "Diagnostic_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadDiagnostic() // this example assumes you already have this ApiManagementDiagnosticResource created on azure // for more information of creating ApiManagementDiagnosticResource, please refer to the document of ApiManagementDiagnosticResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string diagnosticId = "applicationinsights"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDiagnostic.json // this example is just showing the usage of "Diagnostic_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetDiagnostic() // this example assumes you already have this ApiManagementDiagnosticResource created on azure // for more information of creating ApiManagementDiagnosticResource, please refer to the document of ApiManagementDiagnosticResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string diagnosticId = "applicationinsights"; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateDiagnostic.json // this example is just showing the usage of "Diagnostic_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateDiagnostic() // this example assumes you already have this ApiManagementDiagnosticResource created on azure // for more information of creating ApiManagementDiagnosticResource, please refer to the document of ApiManagementDiagnosticResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string diagnosticId = "applicationinsights"; @@ -164,7 +164,7 @@ public async Task Update_ApiManagementUpdateDiagnostic() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteDiagnostic() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteDiagnostic.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteDiagnostic.json // this example is just showing the usage of "Diagnostic_Delete" 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 @@ -174,7 +174,7 @@ public async Task Delete_ApiManagementDeleteDiagnostic() // this example assumes you already have this ApiManagementDiagnosticResource created on azure // for more information of creating ApiManagementDiagnosticResource, please refer to the document of ApiManagementDiagnosticResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string diagnosticId = "applicationinsights"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateCollection.cs index 27a117015fea..d2843144da13 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementEmailTemplateCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListTemplates() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTemplates.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListTemplates.json // this example is just showing the usage of "EmailTemplate_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListTemplates() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListTemplates() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTemplate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTemplate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTemplate.json // this example is just showing the usage of "EmailTemplate_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetTemplate() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetTemplate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetTemplate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTemplate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTemplate.json // this example is just showing the usage of "EmailTemplate_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetTemplate() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetTemplate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetTemplate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTemplate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTemplate.json // this example is just showing the usage of "EmailTemplate_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetTemplate() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetTemplate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateTemplate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateTemplate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateTemplate.json // this example is just showing the usage of "EmailTemplate_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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateTemplate() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateResource.cs index 515fdc916ee9..a53e12df2f5d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementEmailTemplateResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementEmailTemplateResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadEmailTemplate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadEmailTemplate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadEmailTemplate.json // this example is just showing the usage of "EmailTemplate_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadEmailTemplate() // this example assumes you already have this ApiManagementEmailTemplateResource created on azure // for more information of creating ApiManagementEmailTemplateResource, please refer to the document of ApiManagementEmailTemplateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; TemplateName templateName = TemplateName.NewIssueNotificationMessage; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadEmailTemplate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTemplate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTemplate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTemplate.json // this example is just showing the usage of "EmailTemplate_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetTemplate() // this example assumes you already have this ApiManagementEmailTemplateResource created on azure // for more information of creating ApiManagementEmailTemplateResource, please refer to the document of ApiManagementEmailTemplateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; TemplateName templateName = TemplateName.NewIssueNotificationMessage; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetTemplate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateTemplate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateTemplate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateTemplate.json // this example is just showing the usage of "EmailTemplate_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateTemplate() // this example assumes you already have this ApiManagementEmailTemplateResource created on azure // for more information of creating ApiManagementEmailTemplateResource, please refer to the document of ApiManagementEmailTemplateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; TemplateName templateName = TemplateName.NewIssueNotificationMessage; @@ -121,7 +121,7 @@ public async Task Update_ApiManagementUpdateTemplate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteTemplate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteTemplate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteTemplate.json // this example is just showing the usage of "EmailTemplate_Delete" 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 @@ -131,7 +131,7 @@ public async Task Delete_ApiManagementDeleteTemplate() // this example assumes you already have this ApiManagementEmailTemplateResource created on azure // for more information of creating ApiManagementEmailTemplateResource, please refer to the document of ApiManagementEmailTemplateResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; TemplateName templateName = TemplateName.NewIssueNotificationMessage; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityCollection.cs index a05cf0e4a7db..23057fa9ca8c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementGatewayCertificateAuthorityCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListGatewaycertificateAuthorities() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGatewayCertificateAuthorities.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListGatewayCertificateAuthorities.json // this example is just showing the usage of "GatewayCertificateAuthority_ListByService" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListGatewaycertificateAuthorities() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListGatewaycertificateAuthorities() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetGatewayCertificateAuthority() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayCertificateAuthority.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGatewayCertificateAuthority.json // this example is just showing the usage of "GatewayCertificateAuthority_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetGatewayCertificateAuthority() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -96,7 +96,7 @@ public async Task Get_ApiManagementGetGatewayCertificateAuthority() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetGatewayCertificateAuthority() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayCertificateAuthority.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGatewayCertificateAuthority.json // this example is just showing the usage of "GatewayCertificateAuthority_Get" 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 @@ -106,7 +106,7 @@ public async Task Exists_ApiManagementGetGatewayCertificateAuthority() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -128,7 +128,7 @@ public async Task Exists_ApiManagementGetGatewayCertificateAuthority() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetGatewayCertificateAuthority() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayCertificateAuthority.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGatewayCertificateAuthority.json // this example is just showing the usage of "GatewayCertificateAuthority_Get" 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 @@ -138,7 +138,7 @@ public async Task GetIfExists_ApiManagementGetGatewayCertificateAuthority() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -172,7 +172,7 @@ public async Task GetIfExists_ApiManagementGetGatewayCertificateAuthority() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateGatewayCertificateAuthority() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayCertificateAuthority.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGatewayCertificateAuthority.json // this example is just showing the usage of "GatewayCertificateAuthority_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 @@ -182,7 +182,7 @@ public async Task CreateOrUpdate_ApiManagementCreateGatewayCertificateAuthority( // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityResource.cs index a8e3d34b7fd3..834e0530b9f0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCertificateAuthorityResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementGatewayCertificateAuthorityResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadGatewayCertificateAuthority() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGatewayCertificateAuthority.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadGatewayCertificateAuthority.json // this example is just showing the usage of "GatewayCertificateAuthority_GetEntityTag" 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 @@ -32,7 +32,7 @@ public async Task GetEntityTag_ApiManagementHeadGatewayCertificateAuthority() // this example assumes you already have this ApiManagementGatewayCertificateAuthorityResource created on azure // for more information of creating ApiManagementGatewayCertificateAuthorityResource, please refer to the document of ApiManagementGatewayCertificateAuthorityResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadGatewayCertificateAuthority() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetGatewayCertificateAuthority() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayCertificateAuthority.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGatewayCertificateAuthority.json // this example is just showing the usage of "GatewayCertificateAuthority_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetGatewayCertificateAuthority() // this example assumes you already have this ApiManagementGatewayCertificateAuthorityResource created on azure // for more information of creating ApiManagementGatewayCertificateAuthorityResource, please refer to the document of ApiManagementGatewayCertificateAuthorityResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -84,7 +84,7 @@ public async Task Get_ApiManagementGetGatewayCertificateAuthority() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateGatewayCertificateAuthority() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayCertificateAuthority.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGatewayCertificateAuthority.json // this example is just showing the usage of "GatewayCertificateAuthority_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 @@ -94,7 +94,7 @@ public async Task Update_ApiManagementCreateGatewayCertificateAuthority() // this example assumes you already have this ApiManagementGatewayCertificateAuthorityResource created on azure // for more information of creating ApiManagementGatewayCertificateAuthorityResource, please refer to the document of ApiManagementGatewayCertificateAuthorityResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -122,7 +122,7 @@ public async Task Update_ApiManagementCreateGatewayCertificateAuthority() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteGatewayCertificateAuthority() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGatewayCertificateAuthority.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteGatewayCertificateAuthority.json // this example is just showing the usage of "GatewayCertificateAuthority_Delete" 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 @@ -132,7 +132,7 @@ public async Task Delete_ApiManagementDeleteGatewayCertificateAuthority() // this example assumes you already have this ApiManagementGatewayCertificateAuthorityResource created on azure // for more information of creating ApiManagementGatewayCertificateAuthorityResource, please refer to the document of ApiManagementGatewayCertificateAuthorityResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCollection.cs index 9066d33ee99e..62374521a956 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementGatewayCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListGateways() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGateways.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListGateways.json // this example is just showing the usage of "Gateway_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListGateways() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListGateways() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetGateway() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGateway.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGateway.json // this example is just showing the usage of "Gateway_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetGateway() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetGateway() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetGateway() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGateway.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGateway.json // this example is just showing the usage of "Gateway_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetGateway() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetGateway() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetGateway() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGateway.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGateway.json // this example is just showing the usage of "Gateway_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetGateway() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetGateway() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateGateway() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGateway.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGateway.json // this example is just showing the usage of "Gateway_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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateGateway() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationCollection.cs index 3dad54e229e3..a074f7e9cfd6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementGatewayHostnameConfigurationCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListGatewayHostnameConfigurations() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGatewayHostnameConfigurations.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListGatewayHostnameConfigurations.json // this example is just showing the usage of "GatewayHostnameConfiguration_ListByService" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListGatewayHostnameConfigurations() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListGatewayHostnameConfigurations() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetGatewayHostnameConfiguration() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayHostnameConfiguration.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGatewayHostnameConfiguration.json // this example is just showing the usage of "GatewayHostnameConfiguration_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetGatewayHostnameConfiguration() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -96,7 +96,7 @@ public async Task Get_ApiManagementGetGatewayHostnameConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetGatewayHostnameConfiguration() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayHostnameConfiguration.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGatewayHostnameConfiguration.json // this example is just showing the usage of "GatewayHostnameConfiguration_Get" 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 @@ -106,7 +106,7 @@ public async Task Exists_ApiManagementGetGatewayHostnameConfiguration() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -128,7 +128,7 @@ public async Task Exists_ApiManagementGetGatewayHostnameConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetGatewayHostnameConfiguration() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayHostnameConfiguration.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGatewayHostnameConfiguration.json // this example is just showing the usage of "GatewayHostnameConfiguration_Get" 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 @@ -138,7 +138,7 @@ public async Task GetIfExists_ApiManagementGetGatewayHostnameConfiguration() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -172,7 +172,7 @@ public async Task GetIfExists_ApiManagementGetGatewayHostnameConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateGatewayHostnameConfiguration() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayHostnameConfiguration.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGatewayHostnameConfiguration.json // this example is just showing the usage of "GatewayHostnameConfiguration_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 @@ -182,7 +182,7 @@ public async Task CreateOrUpdate_ApiManagementCreateGatewayHostnameConfiguration // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -197,7 +197,7 @@ public async Task CreateOrUpdate_ApiManagementCreateGatewayHostnameConfiguration ApiManagementGatewayHostnameConfigurationData data = new ApiManagementGatewayHostnameConfigurationData() { Hostname = "*", - CertificateId = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1", + CertificateId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1", IsClientCertificateRequired = false, IsTls1_0Enabled = false, IsTls1_1Enabled = false, diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationResource.cs index cb07440026b1..f0ae23aee25e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayHostnameConfigurationResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementGatewayHostnameConfigurationResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadGatewayHostnameConfiguration() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGatewayHostnameConfiguration.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadGatewayHostnameConfiguration.json // this example is just showing the usage of "GatewayHostnameConfiguration_GetEntityTag" 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 @@ -32,7 +32,7 @@ public async Task GetEntityTag_ApiManagementHeadGatewayHostnameConfiguration() // this example assumes you already have this ApiManagementGatewayHostnameConfigurationResource created on azure // for more information of creating ApiManagementGatewayHostnameConfigurationResource, please refer to the document of ApiManagementGatewayHostnameConfigurationResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadGatewayHostnameConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetGatewayHostnameConfiguration() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGatewayHostnameConfiguration.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGatewayHostnameConfiguration.json // this example is just showing the usage of "GatewayHostnameConfiguration_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetGatewayHostnameConfiguration() // this example assumes you already have this ApiManagementGatewayHostnameConfigurationResource created on azure // for more information of creating ApiManagementGatewayHostnameConfigurationResource, please refer to the document of ApiManagementGatewayHostnameConfigurationResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -84,7 +84,7 @@ public async Task Get_ApiManagementGetGatewayHostnameConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateGatewayHostnameConfiguration() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayHostnameConfiguration.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGatewayHostnameConfiguration.json // this example is just showing the usage of "GatewayHostnameConfiguration_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 @@ -94,7 +94,7 @@ public async Task Update_ApiManagementCreateGatewayHostnameConfiguration() // this example assumes you already have this ApiManagementGatewayHostnameConfigurationResource created on azure // for more information of creating ApiManagementGatewayHostnameConfigurationResource, please refer to the document of ApiManagementGatewayHostnameConfigurationResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -106,7 +106,7 @@ public async Task Update_ApiManagementCreateGatewayHostnameConfiguration() ApiManagementGatewayHostnameConfigurationData data = new ApiManagementGatewayHostnameConfigurationData() { Hostname = "*", - CertificateId = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1", + CertificateId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1", IsClientCertificateRequired = false, IsTls1_0Enabled = false, IsTls1_1Enabled = false, @@ -127,7 +127,7 @@ public async Task Update_ApiManagementCreateGatewayHostnameConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteGatewayHostnameConfiguration() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGatewayHostnameConfiguration.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteGatewayHostnameConfiguration.json // this example is just showing the usage of "GatewayHostnameConfiguration_Delete" 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 @@ -137,7 +137,7 @@ public async Task Delete_ApiManagementDeleteGatewayHostnameConfiguration() // this example assumes you already have this ApiManagementGatewayHostnameConfigurationResource created on azure // for more information of creating ApiManagementGatewayHostnameConfigurationResource, please refer to the document of ApiManagementGatewayHostnameConfigurationResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayResource.cs index 255e3ceaa4e6..ef465671e647 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGatewayResource.cs @@ -6,7 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; using System.Threading.Tasks; +using System.Xml; using Azure; using Azure.Core; using Azure.Identity; @@ -23,7 +25,7 @@ public partial class Sample_ApiManagementGatewayResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadGateway() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGateway.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadGateway.json // this example is just showing the usage of "Gateway_GetEntityTag" 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 @@ -33,7 +35,7 @@ public async Task GetEntityTag_ApiManagementHeadGateway() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "mygateway"; @@ -51,7 +53,7 @@ public async Task GetEntityTag_ApiManagementHeadGateway() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetGateway() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGateway.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGateway.json // this example is just showing the usage of "Gateway_Get" 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 @@ -61,7 +63,7 @@ public async Task Get_ApiManagementGetGateway() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -83,7 +85,7 @@ public async Task Get_ApiManagementGetGateway() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateGateway() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateGateway.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateGateway.json // this example is just showing the usage of "Gateway_Update" 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 @@ -93,7 +95,7 @@ public async Task Update_ApiManagementUpdateGateway() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -121,7 +123,7 @@ public async Task Update_ApiManagementUpdateGateway() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteGateway() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGateway.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteGateway.json // this example is just showing the usage of "Gateway_Delete" 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 @@ -131,7 +133,7 @@ public async Task Delete_ApiManagementDeleteGateway() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -150,7 +152,7 @@ public async Task Delete_ApiManagementDeleteGateway() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetKeys_ApiManagementGatewayListKeys() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGatewayListKeys.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGatewayListKeys.json // this example is just showing the usage of "Gateway_ListKeys" 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 @@ -160,7 +162,7 @@ public async Task GetKeys_ApiManagementGatewayListKeys() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -178,7 +180,7 @@ public async Task GetKeys_ApiManagementGatewayListKeys() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegenerateKey_ApiManagementGatewayRegenerateKey() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGatewayRegenerateKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGatewayRegenerateKey.json // this example is just showing the usage of "Gateway_RegenerateKey" 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 @@ -188,7 +190,7 @@ public async Task RegenerateKey_ApiManagementGatewayRegenerateKey() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gwId"; @@ -207,7 +209,7 @@ public async Task RegenerateKey_ApiManagementGatewayRegenerateKey() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GenerateToken_ApiManagementGatewayGenerateToken() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGatewayGenerateToken.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGatewayGenerateToken.json // this example is just showing the usage of "Gateway_GenerateToken" 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 @@ -217,7 +219,7 @@ public async Task GenerateToken_ApiManagementGatewayGenerateToken() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -231,12 +233,108 @@ public async Task GenerateToken_ApiManagementGatewayGenerateToken() Console.WriteLine($"Succeeded: {result}"); } + // ApiManagementGatewayInvalidateDebugCredentials + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task InvalidateDebugCredentials_ApiManagementGatewayInvalidateDebugCredentials() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGatewayInvalidateDebugCredentials.json + // this example is just showing the usage of "Gateway_InvalidateDebugCredentials" 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 ApiManagementGatewayResource created on azure + // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string gatewayId = "gw1"; + ResourceIdentifier apiManagementGatewayResourceId = ApiManagementGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, gatewayId); + ApiManagementGatewayResource apiManagementGateway = client.GetApiManagementGatewayResource(apiManagementGatewayResourceId); + + // invoke the operation + await apiManagementGateway.InvalidateDebugCredentialsAsync(); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGatewayListDebugCredentials + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetDebugCredentials_ApiManagementGatewayListDebugCredentials() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGatewayListDebugCredentials.json + // this example is just showing the usage of "Gateway_ListDebugCredentials" 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 ApiManagementGatewayResource created on azure + // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string gatewayId = "gw1"; + ResourceIdentifier apiManagementGatewayResourceId = ApiManagementGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, gatewayId); + ApiManagementGatewayResource apiManagementGateway = client.GetApiManagementGatewayResource(apiManagementGatewayResourceId); + + // invoke the operation + GatewayListDebugCredentialsContract gatewayListDebugCredentialsContract = new GatewayListDebugCredentialsContract(new GatewayListDebugCredentialsContractPurpose[] + { +GatewayListDebugCredentialsContractPurpose.Tracing + }, new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1")) + { + CredentialsExpireAfter = XmlConvert.ToTimeSpan("PT1H"), + }; + GatewayDebugCredentialsContract result = await apiManagementGateway.GetDebugCredentialsAsync(gatewayListDebugCredentialsContract); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGatewayListTrace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetTrace_ApiManagementGatewayListTrace() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGatewayListTrace.json + // this example is just showing the usage of "Gateway_ListTrace" 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 ApiManagementGatewayResource created on azure + // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string gatewayId = "gw1"; + ResourceIdentifier apiManagementGatewayResourceId = ApiManagementGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, gatewayId); + ApiManagementGatewayResource apiManagementGateway = client.GetApiManagementGatewayResource(apiManagementGatewayResourceId); + + // invoke the operation + GatewayListTraceContract gatewayListTraceContract = new GatewayListTraceContract() + { + TraceId = "CrDvXXXXXXXXXXXXXVU3ZA2-1", + }; + Response> response = await apiManagementGateway.GetTraceAsync(gatewayListTraceContract); + IReadOnlyDictionary result = response.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + // ApiManagementListGatewayApis [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetGatewayApisByService_ApiManagementListGatewayApis() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGatewayApis.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListGatewayApis.json // this example is just showing the usage of "GatewayApi_ListByService" 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 @@ -246,7 +344,7 @@ public async Task GetGatewayApisByService_ApiManagementListGatewayApis() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -267,7 +365,7 @@ public async Task GetGatewayApisByService_ApiManagementListGatewayApis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetGatewayApiEntityTag_ApiManagementHeadGatewayApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGatewayApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadGatewayApi.json // this example is just showing the usage of "GatewayApi_GetEntityTag" 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 @@ -277,7 +375,7 @@ public async Task GetGatewayApiEntityTag_ApiManagementHeadGatewayApi() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -296,7 +394,7 @@ public async Task GetGatewayApiEntityTag_ApiManagementHeadGatewayApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateGatewayApi_ApiManagementCreateGatewayApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGatewayApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGatewayApi.json // this example is just showing the usage of "GatewayApi_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 @@ -306,7 +404,7 @@ public async Task CreateOrUpdateGatewayApi_ApiManagementCreateGatewayApi() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; @@ -329,7 +427,7 @@ public async Task CreateOrUpdateGatewayApi_ApiManagementCreateGatewayApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteGatewayApi_ApiManagementDeleteGatewayApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGatewayApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteGatewayApi.json // this example is just showing the usage of "GatewayApi_Delete" 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 @@ -339,7 +437,7 @@ public async Task DeleteGatewayApi_ApiManagementDeleteGatewayApi() // this example assumes you already have this ApiManagementGatewayResource created on azure // for more information of creating ApiManagementGatewayResource, please refer to the document of ApiManagementGatewayResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string gatewayId = "gw1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderCollection.cs index 20f04fc29b80..35594441e9f5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementIdentityProviderCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListIdentityProviders() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListIdentityProviders.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListIdentityProviders.json // this example is just showing the usage of "IdentityProvider_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListIdentityProviders() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListIdentityProviders() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetIdentityProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIdentityProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetIdentityProvider.json // this example is just showing the usage of "IdentityProvider_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetIdentityProvider() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetIdentityProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetIdentityProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIdentityProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetIdentityProvider.json // this example is just showing the usage of "IdentityProvider_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetIdentityProvider() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetIdentityProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetIdentityProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIdentityProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetIdentityProvider.json // this example is just showing the usage of "IdentityProvider_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetIdentityProvider() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetIdentityProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateIdentityProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateIdentityProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateIdentityProvider.json // this example is just showing the usage of "IdentityProvider_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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateIdentityProvider() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderResource.cs index 9159d4368642..2306c9ede5a8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIdentityProviderResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementIdentityProviderResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadIdentityProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadIdentityProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadIdentityProvider.json // this example is just showing the usage of "IdentityProvider_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadIdentityProvider() // this example assumes you already have this ApiManagementIdentityProviderResource created on azure // for more information of creating ApiManagementIdentityProviderResource, please refer to the document of ApiManagementIdentityProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; IdentityProviderType identityProviderName = IdentityProviderType.AadB2C; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadIdentityProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetIdentityProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIdentityProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetIdentityProvider.json // this example is just showing the usage of "IdentityProvider_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetIdentityProvider() // this example assumes you already have this ApiManagementIdentityProviderResource created on azure // for more information of creating ApiManagementIdentityProviderResource, please refer to the document of ApiManagementIdentityProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; IdentityProviderType identityProviderName = IdentityProviderType.AadB2C; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetIdentityProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateIdentityProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateIdentityProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateIdentityProvider.json // this example is just showing the usage of "IdentityProvider_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateIdentityProvider() // this example assumes you already have this ApiManagementIdentityProviderResource created on azure // for more information of creating ApiManagementIdentityProviderResource, please refer to the document of ApiManagementIdentityProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; IdentityProviderType identityProviderName = IdentityProviderType.Facebook; @@ -121,7 +121,7 @@ public async Task Update_ApiManagementUpdateIdentityProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteIdentityProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteIdentityProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteIdentityProvider.json // this example is just showing the usage of "IdentityProvider_Delete" 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 @@ -131,7 +131,7 @@ public async Task Delete_ApiManagementDeleteIdentityProvider() // this example assumes you already have this ApiManagementIdentityProviderResource created on azure // for more information of creating ApiManagementIdentityProviderResource, please refer to the document of ApiManagementIdentityProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; IdentityProviderType identityProviderName = IdentityProviderType.Aad; @@ -150,7 +150,7 @@ public async Task Delete_ApiManagementDeleteIdentityProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSecrets_ApiManagementIdentityProviderListSecrets() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementIdentityProviderListSecrets.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementIdentityProviderListSecrets.json // this example is just showing the usage of "IdentityProvider_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 @@ -160,7 +160,7 @@ public async Task GetSecrets_ApiManagementIdentityProviderListSecrets() // this example assumes you already have this ApiManagementIdentityProviderResource created on azure // for more information of creating ApiManagementIdentityProviderResource, please refer to the document of ApiManagementIdentityProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; IdentityProviderType identityProviderName = IdentityProviderType.AadB2C; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueCollection.cs index bc75552f6e90..1c36d0e4a5d5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementIssueCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListIssues() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListIssues.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListIssues.json // this example is just showing the usage of "Issue_ListByService" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListIssues() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -59,7 +59,7 @@ public async Task GetAll_ApiManagementListIssues() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetIssue.json // this example is just showing the usage of "Issue_Get" 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 @@ -69,7 +69,7 @@ public async Task Get_ApiManagementGetIssue() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -94,7 +94,7 @@ public async Task Get_ApiManagementGetIssue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetIssue.json // this example is just showing the usage of "Issue_Get" 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 @@ -104,7 +104,7 @@ public async Task Exists_ApiManagementGetIssue() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -125,7 +125,7 @@ public async Task Exists_ApiManagementGetIssue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetIssue.json // this example is just showing the usage of "Issue_Get" 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 @@ -135,7 +135,7 @@ public async Task GetIfExists_ApiManagementGetIssue() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueResource.cs index 2fb4e8f2c00e..50eeff83f404 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementIssueResource.cs @@ -21,7 +21,7 @@ public partial class Sample_ApiManagementIssueResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetIssue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetIssue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetIssue.json // this example is just showing the usage of "Issue_Get" 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 @@ -31,7 +31,7 @@ public async Task Get_ApiManagementGetIssue() // this example assumes you already have this ApiManagementIssueResource created on azure // for more information of creating ApiManagementIssueResource, please refer to the document of ApiManagementIssueResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string issueId = "57d2ef278aa04f0ad01d6cdc"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerCollection.cs index ffa87a52e2b6..edf41c6cccd9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementLoggerCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListLoggers() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListLoggers.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListLoggers.json // this example is just showing the usage of "Logger_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListLoggers() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListLoggers() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetLogger() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetLogger.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetLogger.json // this example is just showing the usage of "Logger_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetLogger() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetLogger() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetLogger() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetLogger.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetLogger.json // this example is just showing the usage of "Logger_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetLogger() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetLogger() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetLogger() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetLogger.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetLogger.json // this example is just showing the usage of "Logger_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetLogger() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetLogger() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateAILogger() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateAILogger.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateAILogger() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -214,7 +214,7 @@ public async Task CreateOrUpdate_ApiManagementCreateAILogger() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateEHLogger() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateEHLogger.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateEHLogger.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 @@ -224,7 +224,7 @@ public async Task CreateOrUpdate_ApiManagementCreateEHLogger() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerResource.cs index 521ae13d9ad3..05060a0779b4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementLoggerResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementLoggerResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadLogger() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadLogger.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadLogger.json // this example is just showing the usage of "Logger_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadLogger() // this example assumes you already have this ApiManagementLoggerResource created on azure // for more information of creating ApiManagementLoggerResource, please refer to the document of ApiManagementLoggerResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string loggerId = "templateLogger"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadLogger() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetLogger() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetLogger.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetLogger.json // this example is just showing the usage of "Logger_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetLogger() // this example assumes you already have this ApiManagementLoggerResource created on azure // for more information of creating ApiManagementLoggerResource, please refer to the document of ApiManagementLoggerResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string loggerId = "templateLogger"; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetLogger() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateLogger() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateLogger.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateLogger.json // this example is just showing the usage of "Logger_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateLogger() // this example assumes you already have this ApiManagementLoggerResource created on azure // for more information of creating ApiManagementLoggerResource, please refer to the document of ApiManagementLoggerResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string loggerId = "eh1"; @@ -121,7 +121,7 @@ public async Task Update_ApiManagementUpdateLogger() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteLogger() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteLogger.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteLogger.json // this example is just showing the usage of "Logger_Delete" 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 @@ -131,7 +131,7 @@ public async Task Delete_ApiManagementDeleteLogger() // this example assumes you already have this ApiManagementLoggerResource created on azure // for more information of creating ApiManagementLoggerResource, please refer to the document of ApiManagementLoggerResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string loggerId = "loggerId"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderCollection.cs index 0172734dfc86..fafd0939de7b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementOpenIdConnectProviderCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListOpenIdConnectProviders() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListOpenIdConnectProviders.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListOpenIdConnectProviders.json // this example is just showing the usage of "OpenIdConnectProvider_ListByService" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListOpenIdConnectProviders() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -59,7 +59,7 @@ public async Task GetAll_ApiManagementListOpenIdConnectProviders() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetOpenIdConnectProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetOpenIdConnectProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetOpenIdConnectProvider.json // this example is just showing the usage of "OpenIdConnectProvider_Get" 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 @@ -69,7 +69,7 @@ public async Task Get_ApiManagementGetOpenIdConnectProvider() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -94,7 +94,7 @@ public async Task Get_ApiManagementGetOpenIdConnectProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetOpenIdConnectProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetOpenIdConnectProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetOpenIdConnectProvider.json // this example is just showing the usage of "OpenIdConnectProvider_Get" 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 @@ -104,7 +104,7 @@ public async Task Exists_ApiManagementGetOpenIdConnectProvider() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -125,7 +125,7 @@ public async Task Exists_ApiManagementGetOpenIdConnectProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetOpenIdConnectProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetOpenIdConnectProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetOpenIdConnectProvider.json // this example is just showing the usage of "OpenIdConnectProvider_Get" 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 @@ -135,7 +135,7 @@ public async Task GetIfExists_ApiManagementGetOpenIdConnectProvider() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -168,7 +168,7 @@ public async Task GetIfExists_ApiManagementGetOpenIdConnectProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateOpenIdConnectProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateOpenIdConnectProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateOpenIdConnectProvider.json // this example is just showing the usage of "OpenIdConnectProvider_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 @@ -178,7 +178,7 @@ public async Task CreateOrUpdate_ApiManagementCreateOpenIdConnectProvider() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -195,6 +195,8 @@ public async Task CreateOrUpdate_ApiManagementCreateOpenIdConnectProvider() MetadataEndpoint = "https://oidprovider-template3.net", ClientId = "oidprovidertemplate3", ClientSecret = "x", + UseInTestConsole = false, + UseInApiDocumentation = true, }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, openId, data); ApiManagementOpenIdConnectProviderResource result = lro.Value; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderResource.cs index 803e2af80b91..8c29543d5f47 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementOpenIdConnectProviderResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementOpenIdConnectProviderResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadOpenIdConnectProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadOpenIdConnectProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadOpenIdConnectProvider.json // this example is just showing the usage of "OpenIdConnectProvider_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadOpenIdConnectProvider() // this example assumes you already have this ApiManagementOpenIdConnectProviderResource created on azure // for more information of creating ApiManagementOpenIdConnectProviderResource, please refer to the document of ApiManagementOpenIdConnectProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string openId = "templateOpenIdConnect2"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadOpenIdConnectProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetOpenIdConnectProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetOpenIdConnectProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetOpenIdConnectProvider.json // this example is just showing the usage of "OpenIdConnectProvider_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetOpenIdConnectProvider() // this example assumes you already have this ApiManagementOpenIdConnectProviderResource created on azure // for more information of creating ApiManagementOpenIdConnectProviderResource, please refer to the document of ApiManagementOpenIdConnectProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string openId = "templateOpenIdConnect2"; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetOpenIdConnectProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateOpenIdConnectProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateOpenIdConnectProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateOpenIdConnectProvider.json // this example is just showing the usage of "OpenIdConnectProvider_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateOpenIdConnectProvider() // this example assumes you already have this ApiManagementOpenIdConnectProviderResource created on azure // for more information of creating ApiManagementOpenIdConnectProviderResource, please refer to the document of ApiManagementOpenIdConnectProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string openId = "templateOpenIdConnect2"; @@ -105,6 +105,8 @@ public async Task Update_ApiManagementUpdateOpenIdConnectProvider() ApiManagementOpenIdConnectProviderPatch patch = new ApiManagementOpenIdConnectProviderPatch() { ClientSecret = "updatedsecret", + UseInTestConsole = false, + UseInApiDocumentation = true, }; ApiManagementOpenIdConnectProviderResource result = await apiManagementOpenIdConnectProvider.UpdateAsync(ifMatch, patch); @@ -120,7 +122,7 @@ public async Task Update_ApiManagementUpdateOpenIdConnectProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteOpenIdConnectProvider() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteOpenIdConnectProvider.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteOpenIdConnectProvider.json // this example is just showing the usage of "OpenIdConnectProvider_Delete" 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 @@ -130,7 +132,7 @@ public async Task Delete_ApiManagementDeleteOpenIdConnectProvider() // this example assumes you already have this ApiManagementOpenIdConnectProviderResource created on azure // for more information of creating ApiManagementOpenIdConnectProviderResource, please refer to the document of ApiManagementOpenIdConnectProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string openId = "templateOpenIdConnect3"; @@ -149,7 +151,7 @@ public async Task Delete_ApiManagementDeleteOpenIdConnectProvider() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSecrets_ApiManagementOpenidConnectProviderListSecrets() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementOpenidConnectProviderListSecrets.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementOpenidConnectProviderListSecrets.json // this example is just showing the usage of "OpenIdConnectProvider_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 @@ -159,7 +161,7 @@ public async Task GetSecrets_ApiManagementOpenidConnectProviderListSecrets() // this example assumes you already have this ApiManagementOpenIdConnectProviderResource created on azure // for more information of creating ApiManagementOpenIdConnectProviderResource, please refer to the document of ApiManagementOpenIdConnectProviderResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string openId = "templateOpenIdConnect2"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyCollection.cs index aa6b16663b58..ac8298ffbd73 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementPolicyCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListPolicies() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPolicies.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPolicies.json // this example is just showing the usage of "Policy_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListPolicies() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListPolicies() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicy.json // this example is just showing the usage of "Policy_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetPolicy() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicy.json // this example is just showing the usage of "Policy_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetPolicy() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicy.json // this example is just showing the usage of "Policy_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetPolicy() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPolicyFormat() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicyFormat.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFormat.json // this example is just showing the usage of "Policy_Get" 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 @@ -179,7 +179,7 @@ public async Task Get_ApiManagementGetPolicyFormat() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -205,7 +205,7 @@ public async Task Get_ApiManagementGetPolicyFormat() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetPolicyFormat() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicyFormat.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFormat.json // this example is just showing the usage of "Policy_Get" 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 @@ -215,7 +215,7 @@ public async Task Exists_ApiManagementGetPolicyFormat() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -237,7 +237,7 @@ public async Task Exists_ApiManagementGetPolicyFormat() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetPolicyFormat() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicyFormat.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFormat.json // this example is just showing the usage of "Policy_Get" 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 @@ -247,7 +247,7 @@ public async Task GetIfExists_ApiManagementGetPolicyFormat() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -281,7 +281,7 @@ public async Task GetIfExists_ApiManagementGetPolicyFormat() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreatePolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreatePolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreatePolicy.json // this example is just showing the usage of "Policy_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 @@ -291,7 +291,7 @@ public async Task CreateOrUpdate_ApiManagementCreatePolicy() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyResource.cs index e5f7c885ea70..eedcf4f856d1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPolicyResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementPolicyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadPolicy.json // this example is just showing the usage of "Policy_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadPolicy() // this example assumes you already have this ApiManagementPolicyResource created on azure // for more information of creating ApiManagementPolicyResource, please refer to the document of ApiManagementPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; PolicyName policyId = PolicyName.Policy; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicy.json // this example is just showing the usage of "Policy_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetPolicy() // this example assumes you already have this ApiManagementPolicyResource created on azure // for more information of creating ApiManagementPolicyResource, please refer to the document of ApiManagementPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; PolicyName policyId = PolicyName.Policy; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPolicyFormat() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPolicyFormat.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFormat.json // this example is just showing the usage of "Policy_Get" 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 @@ -93,7 +93,7 @@ public async Task Get_ApiManagementGetPolicyFormat() // this example assumes you already have this ApiManagementPolicyResource created on azure // for more information of creating ApiManagementPolicyResource, please refer to the document of ApiManagementPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; PolicyName policyId = PolicyName.Policy; @@ -116,7 +116,7 @@ public async Task Get_ApiManagementGetPolicyFormat() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreatePolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreatePolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreatePolicy.json // this example is just showing the usage of "Policy_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 @@ -126,7 +126,7 @@ public async Task Update_ApiManagementCreatePolicy() // this example assumes you already have this ApiManagementPolicyResource created on azure // for more information of creating ApiManagementPolicyResource, please refer to the document of ApiManagementPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; PolicyName policyId = PolicyName.Policy; @@ -154,7 +154,7 @@ public async Task Update_ApiManagementCreatePolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeletePolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletePolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeletePolicy.json // this example is just showing the usage of "Policy_Delete" 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 @@ -164,7 +164,7 @@ public async Task Delete_ApiManagementDeletePolicy() // this example assumes you already have this ApiManagementPolicyResource created on azure // for more information of creating ApiManagementPolicyResource, please refer to the document of ApiManagementPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; PolicyName policyId = PolicyName.Policy; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalDelegationSettingResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalDelegationSettingResource.cs index e48d0c46660b..bd8d820a6def 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalDelegationSettingResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalDelegationSettingResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementPortalDelegationSettingResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadDelegationSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadDelegationSettings.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadDelegationSettings.json // this example is just showing the usage of "DelegationSettings_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadDelegationSettings() // this example assumes you already have this ApiManagementPortalDelegationSettingResource created on azure // for more information of creating ApiManagementPortalDelegationSettingResource, please refer to the document of ApiManagementPortalDelegationSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalDelegationSettingResourceId = ApiManagementPortalDelegationSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -50,7 +50,7 @@ public async Task GetEntityTag_ApiManagementHeadDelegationSettings() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementPortalSettingsGetDelegation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsGetDelegation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalSettingsGetDelegation.json // this example is just showing the usage of "DelegationSettings_Get" 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 @@ -60,7 +60,7 @@ public async Task Get_ApiManagementPortalSettingsGetDelegation() // this example assumes you already have this ApiManagementPortalDelegationSettingResource created on azure // for more information of creating ApiManagementPortalDelegationSettingResource, please refer to the document of ApiManagementPortalDelegationSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalDelegationSettingResourceId = ApiManagementPortalDelegationSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -81,7 +81,7 @@ public async Task Get_ApiManagementPortalSettingsGetDelegation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementPortalSettingsUpdateDelegation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsUpdateDelegation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalSettingsUpdateDelegation.json // this example is just showing the usage of "DelegationSettings_Update" 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 @@ -91,7 +91,7 @@ public async Task Update_ApiManagementPortalSettingsUpdateDelegation() // this example assumes you already have this ApiManagementPortalDelegationSettingResource created on azure // for more information of creating ApiManagementPortalDelegationSettingResource, please refer to the document of ApiManagementPortalDelegationSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalDelegationSettingResourceId = ApiManagementPortalDelegationSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -116,7 +116,7 @@ public async Task Update_ApiManagementPortalSettingsUpdateDelegation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementPortalSettingsUpdateDelegation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsPutDelegation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalSettingsPutDelegation.json // this example is just showing the usage of "DelegationSettings_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 @@ -126,7 +126,7 @@ public async Task CreateOrUpdate_ApiManagementPortalSettingsUpdateDelegation() // this example assumes you already have this ApiManagementPortalDelegationSettingResource created on azure // for more information of creating ApiManagementPortalDelegationSettingResource, please refer to the document of ApiManagementPortalDelegationSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalDelegationSettingResourceId = ApiManagementPortalDelegationSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -156,7 +156,7 @@ public async Task CreateOrUpdate_ApiManagementPortalSettingsUpdateDelegation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSecrets_ApiManagementListSecretsPortalSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSecretsPortalSettingsValidationKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListSecretsPortalSettingsValidationKey.json // this example is just showing the usage of "DelegationSettings_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 @@ -166,7 +166,7 @@ public async Task GetSecrets_ApiManagementListSecretsPortalSettings() // this example assumes you already have this ApiManagementPortalDelegationSettingResource created on azure // for more information of creating ApiManagementPortalDelegationSettingResource, please refer to the document of ApiManagementPortalDelegationSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalDelegationSettingResourceId = ApiManagementPortalDelegationSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionCollection.cs index 053a0ea0a840..c04f2268eb7b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementPortalRevisionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListPortalRevisions() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPortalRevisions.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPortalRevisions.json // this example is just showing the usage of "PortalRevision_ListByService" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListPortalRevisions() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -59,7 +59,7 @@ public async Task GetAll_ApiManagementListPortalRevisions() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPortalRevision() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPortalRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPortalRevision.json // this example is just showing the usage of "PortalRevision_Get" 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 @@ -69,7 +69,7 @@ public async Task Get_ApiManagementGetPortalRevision() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -94,7 +94,7 @@ public async Task Get_ApiManagementGetPortalRevision() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetPortalRevision() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPortalRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPortalRevision.json // this example is just showing the usage of "PortalRevision_Get" 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 @@ -104,7 +104,7 @@ public async Task Exists_ApiManagementGetPortalRevision() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -125,7 +125,7 @@ public async Task Exists_ApiManagementGetPortalRevision() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetPortalRevision() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPortalRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPortalRevision.json // this example is just showing the usage of "PortalRevision_Get" 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 @@ -135,7 +135,7 @@ public async Task GetIfExists_ApiManagementGetPortalRevision() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -168,7 +168,7 @@ public async Task GetIfExists_ApiManagementGetPortalRevision() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreatePortalRevision() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreatePortalRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreatePortalRevision.json // this example is just showing the usage of "PortalRevision_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 @@ -178,7 +178,7 @@ public async Task CreateOrUpdate_ApiManagementCreatePortalRevision() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionResource.cs index f111f5f2dd8c..503aacfd26da 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalRevisionResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementPortalRevisionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadPortalRevision() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadPortalRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadPortalRevision.json // this example is just showing the usage of "PortalRevision_GetEntityTag" 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 @@ -32,7 +32,7 @@ public async Task GetEntityTag_ApiManagementHeadPortalRevision() // this example assumes you already have this ApiManagementPortalRevisionResource created on azure // for more information of creating ApiManagementPortalRevisionResource, please refer to the document of ApiManagementPortalRevisionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string portalRevisionId = "20201112101010"; @@ -50,7 +50,7 @@ public async Task GetEntityTag_ApiManagementHeadPortalRevision() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPortalRevision() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPortalRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPortalRevision.json // this example is just showing the usage of "PortalRevision_Get" 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 @@ -60,7 +60,7 @@ public async Task Get_ApiManagementGetPortalRevision() // this example assumes you already have this ApiManagementPortalRevisionResource created on azure // for more information of creating ApiManagementPortalRevisionResource, please refer to the document of ApiManagementPortalRevisionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string portalRevisionId = "20201112101010"; @@ -82,7 +82,7 @@ public async Task Get_ApiManagementGetPortalRevision() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdatePortalRevision() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdatePortalRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdatePortalRevision.json // this example is just showing the usage of "PortalRevision_Update" 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 @@ -92,7 +92,7 @@ public async Task Update_ApiManagementUpdatePortalRevision() // this example assumes you already have this ApiManagementPortalRevisionResource created on azure // for more information of creating ApiManagementPortalRevisionResource, please refer to the document of ApiManagementPortalRevisionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string portalRevisionId = "20201112101010"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalSignInSettingResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalSignInSettingResource.cs index a2789abc0786..5917defe31c6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalSignInSettingResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalSignInSettingResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementPortalSignInSettingResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadSignInSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadSignInSettings.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadSignInSettings.json // this example is just showing the usage of "SignInSettings_GetEntityTag" 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 @@ -32,7 +32,7 @@ public async Task GetEntityTag_ApiManagementHeadSignInSettings() // this example assumes you already have this ApiManagementPortalSignInSettingResource created on azure // for more information of creating ApiManagementPortalSignInSettingResource, please refer to the document of ApiManagementPortalSignInSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalSignInSettingResourceId = ApiManagementPortalSignInSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -49,7 +49,7 @@ public async Task GetEntityTag_ApiManagementHeadSignInSettings() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementPortalSettingsGetSignIn() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsGetSignIn.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalSettingsGetSignIn.json // this example is just showing the usage of "SignInSettings_Get" 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 @@ -59,7 +59,7 @@ public async Task Get_ApiManagementPortalSettingsGetSignIn() // this example assumes you already have this ApiManagementPortalSignInSettingResource created on azure // for more information of creating ApiManagementPortalSignInSettingResource, please refer to the document of ApiManagementPortalSignInSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalSignInSettingResourceId = ApiManagementPortalSignInSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -80,7 +80,7 @@ public async Task Get_ApiManagementPortalSettingsGetSignIn() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementPortalSettingsUpdateSignIn() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsUpdateSignIn.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalSettingsUpdateSignIn.json // this example is just showing the usage of "SignInSettings_Update" 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 @@ -90,7 +90,7 @@ public async Task Update_ApiManagementPortalSettingsUpdateSignIn() // this example assumes you already have this ApiManagementPortalSignInSettingResource created on azure // for more information of creating ApiManagementPortalSignInSettingResource, please refer to the document of ApiManagementPortalSignInSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalSignInSettingResourceId = ApiManagementPortalSignInSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -112,7 +112,7 @@ public async Task Update_ApiManagementPortalSettingsUpdateSignIn() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementPortalSettingsUpdateSignIn() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsPutSignIn.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalSettingsPutSignIn.json // this example is just showing the usage of "SignInSettings_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 @@ -122,7 +122,7 @@ public async Task CreateOrUpdate_ApiManagementPortalSettingsUpdateSignIn() // this example assumes you already have this ApiManagementPortalSignInSettingResource created on azure // for more information of creating ApiManagementPortalSignInSettingResource, please refer to the document of ApiManagementPortalSignInSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalSignInSettingResourceId = ApiManagementPortalSignInSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalSignUpSettingResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalSignUpSettingResource.cs index 00fedeb1b7a6..3fbcf00b6b82 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalSignUpSettingResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPortalSignUpSettingResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementPortalSignUpSettingResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadSignUpSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadSignUpSettings.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadSignUpSettings.json // this example is just showing the usage of "SignUpSettings_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadSignUpSettings() // this example assumes you already have this ApiManagementPortalSignUpSettingResource created on azure // for more information of creating ApiManagementPortalSignUpSettingResource, please refer to the document of ApiManagementPortalSignUpSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalSignUpSettingResourceId = ApiManagementPortalSignUpSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -50,7 +50,7 @@ public async Task GetEntityTag_ApiManagementHeadSignUpSettings() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementPortalSettingsGetSignUp() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsGetSignUp.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalSettingsGetSignUp.json // this example is just showing the usage of "SignUpSettings_Get" 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 @@ -60,7 +60,7 @@ public async Task Get_ApiManagementPortalSettingsGetSignUp() // this example assumes you already have this ApiManagementPortalSignUpSettingResource created on azure // for more information of creating ApiManagementPortalSignUpSettingResource, please refer to the document of ApiManagementPortalSignUpSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalSignUpSettingResourceId = ApiManagementPortalSignUpSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -81,7 +81,7 @@ public async Task Get_ApiManagementPortalSettingsGetSignUp() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementPortalSettingsUpdateSignUp() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsUpdateSignUp.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalSettingsUpdateSignUp.json // this example is just showing the usage of "SignUpSettings_Update" 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 @@ -91,7 +91,7 @@ public async Task Update_ApiManagementPortalSettingsUpdateSignUp() // this example assumes you already have this ApiManagementPortalSignUpSettingResource created on azure // for more information of creating ApiManagementPortalSignUpSettingResource, please refer to the document of ApiManagementPortalSignUpSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalSignUpSettingResourceId = ApiManagementPortalSignUpSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -119,7 +119,7 @@ public async Task Update_ApiManagementPortalSettingsUpdateSignUp() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementPortalSettingsUpdateSignUp() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPortalSettingsPutSignUp.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalSettingsPutSignUp.json // this example is just showing the usage of "SignUpSettings_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 @@ -129,7 +129,7 @@ public async Task CreateOrUpdate_ApiManagementPortalSettingsUpdateSignUp() // this example assumes you already have this ApiManagementPortalSignUpSettingResource created on azure // for more information of creating ApiManagementPortalSignUpSettingResource, please refer to the document of ApiManagementPortalSignUpSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementPortalSignUpSettingResourceId = ApiManagementPortalSignUpSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionCollection.cs index 0f4641dc55c9..ff8987fb7fa9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementPrivateEndpointConnectionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListPrivateEndpointConnections() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPrivateEndpointConnections.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPrivateEndpointConnections.json // this example is just showing the usage of "PrivateEndpointConnection_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListPrivateEndpointConnections() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListPrivateEndpointConnections() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPrivateEndpointConnection() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateEndpointConnection.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnection_GetByName" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetPrivateEndpointConnection() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetPrivateEndpointConnection() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateEndpointConnection.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnection_GetByName" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetPrivateEndpointConnection() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetPrivateEndpointConnection() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateEndpointConnection.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnection_GetByName" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetPrivateEndpointConnection() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementApproveOrRejectPrivateEndpointConnection() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementApproveOrRejectPrivateEndpointConnection.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementApproveOrRejectPrivateEndpointConn // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -192,7 +192,7 @@ public async Task CreateOrUpdate_ApiManagementApproveOrRejectPrivateEndpointConn string privateEndpointConnectionName = "privateEndpointConnectionName"; ApiManagementPrivateEndpointConnectionCreateOrUpdateContent content = new ApiManagementPrivateEndpointConnectionCreateOrUpdateContent() { - Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName"), + Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName"), PrivateLinkServiceConnectionState = new ApiManagementPrivateLinkServiceConnectionState() { Status = ApiManagementPrivateEndpointServiceConnectionStatus.Approved, diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionResource.cs index 510788fe886b..7110ffc5332d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateEndpointConnectionResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementPrivateEndpointConnectionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPrivateEndpointConnection() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateEndpointConnection.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnection_GetByName" 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 @@ -33,7 +33,7 @@ public async Task Get_ApiManagementGetPrivateEndpointConnection() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string privateEndpointConnectionName = "privateEndpointConnectionName"; @@ -55,7 +55,7 @@ public async Task Get_ApiManagementGetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementApproveOrRejectPrivateEndpointConnection() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementApproveOrRejectPrivateEndpointConnection.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -65,7 +65,7 @@ public async Task Update_ApiManagementApproveOrRejectPrivateEndpointConnection() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string privateEndpointConnectionName = "privateEndpointConnectionName"; @@ -75,7 +75,7 @@ public async Task Update_ApiManagementApproveOrRejectPrivateEndpointConnection() // invoke the operation ApiManagementPrivateEndpointConnectionCreateOrUpdateContent content = new ApiManagementPrivateEndpointConnectionCreateOrUpdateContent() { - Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName"), + Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName"), PrivateLinkServiceConnectionState = new ApiManagementPrivateLinkServiceConnectionState() { Status = ApiManagementPrivateEndpointServiceConnectionStatus.Approved, @@ -97,7 +97,7 @@ public async Task Update_ApiManagementApproveOrRejectPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeletePrivateEndpointConnection() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeletePrivateEndpointConnection.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeletePrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnection_Delete" 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 @@ -107,7 +107,7 @@ public async Task Delete_ApiManagementDeletePrivateEndpointConnection() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string privateEndpointConnectionName = "privateEndpointConnectionName"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResource.cs index 0d6426a505db..ee0ae7eef528 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResource.cs @@ -21,7 +21,7 @@ public partial class Sample_ApiManagementPrivateLinkResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPrivateLinkGroupResource() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateLinkGroupResource.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPrivateLinkGroupResource.json // this example is just showing the usage of "PrivateEndpointConnection_GetPrivateLinkResource" 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 @@ -31,7 +31,7 @@ public async Task Get_ApiManagementGetPrivateLinkGroupResource() // this example assumes you already have this ApiManagementPrivateLinkResource created on azure // for more information of creating ApiManagementPrivateLinkResource, please refer to the document of ApiManagementPrivateLinkResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string privateLinkSubResourceName = "privateLinkSubResourceName"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResourceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResourceCollection.cs index e4b99ed9e1ff..50dd9de3670b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResourceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementPrivateLinkResourceCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementPrivateLinkResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListPrivateLinkGroupResources() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPrivateLinkGroupResources.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPrivateLinkGroupResources.json // this example is just showing the usage of "PrivateEndpointConnection_ListPrivateLinkResources" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListPrivateLinkGroupResources() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -59,7 +59,7 @@ public async Task GetAll_ApiManagementListPrivateLinkGroupResources() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetPrivateLinkGroupResource() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateLinkGroupResource.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPrivateLinkGroupResource.json // this example is just showing the usage of "PrivateEndpointConnection_GetPrivateLinkResource" 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 @@ -69,7 +69,7 @@ public async Task Get_ApiManagementGetPrivateLinkGroupResource() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -94,7 +94,7 @@ public async Task Get_ApiManagementGetPrivateLinkGroupResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetPrivateLinkGroupResource() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateLinkGroupResource.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPrivateLinkGroupResource.json // this example is just showing the usage of "PrivateEndpointConnection_GetPrivateLinkResource" 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 @@ -104,7 +104,7 @@ public async Task Exists_ApiManagementGetPrivateLinkGroupResource() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -125,7 +125,7 @@ public async Task Exists_ApiManagementGetPrivateLinkGroupResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetPrivateLinkGroupResource() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetPrivateLinkGroupResource.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPrivateLinkGroupResource.json // this example is just showing the usage of "PrivateEndpointConnection_GetPrivateLinkResource" 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 @@ -135,7 +135,7 @@ public async Task GetIfExists_ApiManagementGetPrivateLinkGroupResource() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyCollection.cs index 01f4866eb7c2..0dd6787d8bb7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementProductPolicyCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListProductPolicies() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductPolicies.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListProductPolicies.json // this example is just showing the usage of "ProductPolicy_ListByProduct" 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 @@ -31,17 +31,17 @@ public async Task GetAll_ApiManagementListProductPolicies() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "armTemplateProduct4"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductPolicyResource - ApiManagementProductPolicyCollection collection = apiManagementProduct.GetApiManagementProductPolicies(); + ApiManagementProductPolicyCollection collection = serviceProduct.GetApiManagementProductPolicies(); // invoke the operation and iterate over the result await foreach (ApiManagementProductPolicyResource item in collection.GetAllAsync()) @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListProductPolicies() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetProductPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductPolicy.json // this example is just showing the usage of "ProductPolicy_Get" 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 @@ -69,17 +69,17 @@ public async Task Get_ApiManagementGetProductPolicy() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "kjoshiarmTemplateProduct4"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductPolicyResource - ApiManagementProductPolicyCollection collection = apiManagementProduct.GetApiManagementProductPolicies(); + ApiManagementProductPolicyCollection collection = serviceProduct.GetApiManagementProductPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -97,7 +97,7 @@ public async Task Get_ApiManagementGetProductPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetProductPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductPolicy.json // this example is just showing the usage of "ProductPolicy_Get" 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 @@ -105,17 +105,17 @@ public async Task Exists_ApiManagementGetProductPolicy() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "kjoshiarmTemplateProduct4"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductPolicyResource - ApiManagementProductPolicyCollection collection = apiManagementProduct.GetApiManagementProductPolicies(); + ApiManagementProductPolicyCollection collection = serviceProduct.GetApiManagementProductPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -129,7 +129,7 @@ public async Task Exists_ApiManagementGetProductPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetProductPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductPolicy.json // this example is just showing the usage of "ProductPolicy_Get" 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 @@ -137,17 +137,17 @@ public async Task GetIfExists_ApiManagementGetProductPolicy() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "kjoshiarmTemplateProduct4"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductPolicyResource - ApiManagementProductPolicyCollection collection = apiManagementProduct.GetApiManagementProductPolicies(); + ApiManagementProductPolicyCollection collection = serviceProduct.GetApiManagementProductPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -173,7 +173,7 @@ public async Task GetIfExists_ApiManagementGetProductPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateProductPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductPolicy.json // this example is just showing the usage of "ProductPolicy_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 @@ -181,17 +181,17 @@ public async Task CreateOrUpdate_ApiManagementCreateProductPolicy() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "5702e97e5157a50f48dce801"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductPolicyResource - ApiManagementProductPolicyCollection collection = apiManagementProduct.GetApiManagementProductPolicies(); + ApiManagementProductPolicyCollection collection = serviceProduct.GetApiManagementProductPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyResource.cs index 89a2243fa5d0..1ec8ffa42642 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductPolicyResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementProductPolicyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadProductPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadProductPolicy.json // this example is just showing the usage of "ProductPolicy_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadProductPolicy() // this example assumes you already have this ApiManagementProductPolicyResource created on azure // for more information of creating ApiManagementProductPolicyResource, please refer to the document of ApiManagementProductPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "unlimited"; @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadProductPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetProductPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductPolicy.json // this example is just showing the usage of "ProductPolicy_Get" 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 @@ -62,7 +62,7 @@ public async Task Get_ApiManagementGetProductPolicy() // this example assumes you already have this ApiManagementProductPolicyResource created on azure // for more information of creating ApiManagementProductPolicyResource, please refer to the document of ApiManagementProductPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "kjoshiarmTemplateProduct4"; @@ -85,7 +85,7 @@ public async Task Get_ApiManagementGetProductPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateProductPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductPolicy.json // this example is just showing the usage of "ProductPolicy_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 @@ -95,7 +95,7 @@ public async Task Update_ApiManagementCreateProductPolicy() // this example assumes you already have this ApiManagementProductPolicyResource created on azure // for more information of creating ApiManagementProductPolicyResource, please refer to the document of ApiManagementProductPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "5702e97e5157a50f48dce801"; @@ -124,7 +124,7 @@ public async Task Update_ApiManagementCreateProductPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteProductPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteProductPolicy.json // this example is just showing the usage of "ProductPolicy_Delete" 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 @@ -134,7 +134,7 @@ public async Task Delete_ApiManagementDeleteProductPolicy() // this example assumes you already have this ApiManagementProductPolicyResource created on azure // for more information of creating ApiManagementProductPolicyResource, please refer to the document of ApiManagementProductPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "testproduct"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagCollection.cs index 04c066c61035..2166e2d365e9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementProductTagCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListProductTags() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductTags.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListProductTags.json // this example is just showing the usage of "Tag_ListByProduct" 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 @@ -30,17 +30,17 @@ public async Task GetAll_ApiManagementListProductTags() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "57d2ef278aa04f0888cba3f1"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductTagResource - ApiManagementProductTagCollection collection = apiManagementProduct.GetApiManagementProductTags(); + ApiManagementProductTagCollection collection = serviceProduct.GetApiManagementProductTags(); // invoke the operation and iterate over the result await foreach (ApiManagementProductTagResource item in collection.GetAllAsync()) @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListProductTags() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetProductTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductTag.json // this example is just showing the usage of "Tag_GetByProduct" 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 @@ -68,17 +68,17 @@ public async Task Get_ApiManagementGetProductTag() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductTagResource - ApiManagementProductTagCollection collection = apiManagementProduct.GetApiManagementProductTags(); + ApiManagementProductTagCollection collection = serviceProduct.GetApiManagementProductTags(); // invoke the operation string tagId = "59306a29e4bbd510dc24e5f9"; @@ -96,7 +96,7 @@ public async Task Get_ApiManagementGetProductTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetProductTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductTag.json // this example is just showing the usage of "Tag_GetByProduct" 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 @@ -104,17 +104,17 @@ public async Task Exists_ApiManagementGetProductTag() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductTagResource - ApiManagementProductTagCollection collection = apiManagementProduct.GetApiManagementProductTags(); + ApiManagementProductTagCollection collection = serviceProduct.GetApiManagementProductTags(); // invoke the operation string tagId = "59306a29e4bbd510dc24e5f9"; @@ -128,7 +128,7 @@ public async Task Exists_ApiManagementGetProductTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetProductTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductTag.json // this example is just showing the usage of "Tag_GetByProduct" 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 @@ -136,17 +136,17 @@ public async Task GetIfExists_ApiManagementGetProductTag() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductTagResource - ApiManagementProductTagCollection collection = apiManagementProduct.GetApiManagementProductTags(); + ApiManagementProductTagCollection collection = serviceProduct.GetApiManagementProductTags(); // invoke the operation string tagId = "59306a29e4bbd510dc24e5f9"; @@ -172,7 +172,7 @@ public async Task GetIfExists_ApiManagementGetProductTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateProductTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductTag.json // this example is just showing the usage of "Tag_AssignToProduct" 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 @@ -180,17 +180,17 @@ public async Task CreateOrUpdate_ApiManagementCreateProductTag() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "5931a75ae4bbd512a88c680b"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // get the collection of this ApiManagementProductTagResource - ApiManagementProductTagCollection collection = apiManagementProduct.GetApiManagementProductTags(); + ApiManagementProductTagCollection collection = serviceProduct.GetApiManagementProductTags(); // invoke the operation string tagId = "tagId1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagResource.cs index b4b0823bac48..91dac3909ad6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductTagResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementProductTagResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityStateByProduct_ApiManagementHeadProductTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadProductTag.json // this example is just showing the usage of "Tag_GetEntityStateByProduct" 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 @@ -32,7 +32,7 @@ public async Task GetEntityStateByProduct_ApiManagementHeadProductTag() // this example assumes you already have this ApiManagementProductTagResource created on azure // for more information of creating ApiManagementProductTagResource, please refer to the document of ApiManagementProductTagResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "59306a29e4bbd510dc24e5f8"; @@ -51,7 +51,7 @@ public async Task GetEntityStateByProduct_ApiManagementHeadProductTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetProductTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProductTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductTag.json // this example is just showing the usage of "Tag_GetByProduct" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetProductTag() // this example assumes you already have this ApiManagementProductTagResource created on azure // for more information of creating ApiManagementProductTagResource, please refer to the document of ApiManagementProductTagResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "59d6bb8f1f7fab13dc67ec9b"; @@ -84,7 +84,7 @@ public async Task Get_ApiManagementGetProductTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateProductTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductTag.json // this example is just showing the usage of "Tag_AssignToProduct" 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 @@ -94,7 +94,7 @@ public async Task Update_ApiManagementCreateProductTag() // this example assumes you already have this ApiManagementProductTagResource created on azure // for more information of creating ApiManagementProductTagResource, please refer to the document of ApiManagementProductTagResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "5931a75ae4bbd512a88c680b"; @@ -118,7 +118,7 @@ public async Task Update_ApiManagementCreateProductTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteProductTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteProductTag.json // this example is just showing the usage of "Tag_DetachFromProduct" 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 @@ -128,7 +128,7 @@ public async Task Delete_ApiManagementDeleteProductTag() // this example assumes you already have this ApiManagementProductTagResource created on azure // for more information of creating ApiManagementProductTagResource, please refer to the document of ApiManagementProductTagResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "59d5b28d1f7fab116c282650"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceCollection.cs index 3a9ab03e0e28..67a1b58e5581 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceCollection.cs @@ -25,7 +25,7 @@ public partial class Sample_ApiManagementServiceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateMultiRegionServiceWithCustomHostname() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateMultiRegionServiceWithCustomHostname.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateMultiRegionServiceWithCustomHostname.json // this example is just showing the usage of "ApiManagementService_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 @@ -35,7 +35,7 @@ public async Task CreateOrUpdate_ApiManagementCreateMultiRegionServiceWithCustom // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -62,6 +62,10 @@ public async Task CreateOrUpdate_ApiManagementCreateMultiRegionServiceWithCustom { EncodedCertificate = "****** Base 64 Encoded Certificate ************", CertificatePassword = "Password", +},new HostnameConfiguration(HostnameType.ConfigurationApi,"configuration-api.msitesting.net") +{ +EncodedCertificate = "****** Base 64 Encoded Certificate ************", +CertificatePassword = "Password", } }, AdditionalLocations = @@ -95,7 +99,7 @@ public async Task CreateOrUpdate_ApiManagementCreateMultiRegionServiceWithCustom [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateService() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateService.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateService.json // this example is just showing the usage of "ApiManagementService_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 @@ -105,7 +109,7 @@ public async Task CreateOrUpdate_ApiManagementCreateService() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -138,7 +142,7 @@ public async Task CreateOrUpdate_ApiManagementCreateService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateServiceHavingMsi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceHavingMsi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceHavingMsi.json // this example is just showing the usage of "ApiManagementService_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 @@ -148,7 +152,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceHavingMsi() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -183,7 +187,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceHavingMsi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateServiceInVnetWithPublicIP() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceInVnetWithPublicIP.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceInVnetWithPublicIP.json // this example is just showing the usage of "ApiManagementService_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 @@ -193,7 +197,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceInVnetWithPublicIP() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -209,10 +213,10 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceInVnetWithPublicIP() { "1","2" }, - PublicIPAddressId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/apimazvnet"), + PublicIPAddressId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/apimazvnet"), VirtualNetworkConfiguration = new VirtualNetworkConfiguration() { - SubnetResourceId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/apimcus/subnets/tenant"), + SubnetResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/apimcus/subnets/tenant"), }, VirtualNetworkType = VirtualNetworkType.External, Tags = @@ -237,7 +241,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceInVnetWithPublicIP() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateServiceInZones() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceInZones.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceInZones.json // this example is just showing the usage of "ApiManagementService_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 @@ -247,7 +251,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceInZones() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -280,12 +284,57 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceInZones() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + // ApiManagementCreateServiceSkuv2Service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateServiceSkuv2Service() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceSkuv2Service.json + // this example is just showing the usage of "ApiManagementService_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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApiManagementServiceResource + ApiManagementServiceCollection collection = resourceGroupResource.GetApiManagementServices(); + + // invoke the operation + string serviceName = "apimService1"; + ApiManagementServiceData data = new ApiManagementServiceData(new AzureLocation("West US"), new ApiManagementServiceSkuProperties(ApiManagementServiceSkuType.StandardV2, 1), "apim@autorestsdk.com", "autorestsdk") + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +["tag3"] = "value3", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, data); + 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}"); + } + // ApiManagementCreateServiceWithCustomHostnameKeyVault [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateServiceWithCustomHostnameKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceWithCustomHostnameKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceWithCustomHostnameKeyVault.json // this example is just showing the usage of "ApiManagementService_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 @@ -295,7 +344,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceWithCustomHostnameKey // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -311,7 +360,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceWithCustomHostnameKey { UserAssignedIdentities = { -[new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), }, }, HostnameConfigurations = @@ -329,6 +378,10 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceWithCustomHostnameKey { KeyVaultSecretUri = new Uri("https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert"), IdentityClientId = "329419bc-adec-4dce-9568-25a6d486e468", +},new HostnameConfiguration(HostnameType.ConfigurationApi,"configuration-api.msitesting.net") +{ +EncodedCertificate = "****** Base 64 Encoded Certificate ************", +CertificatePassword = "Password", } }, VirtualNetworkType = VirtualNetworkType.None, @@ -350,12 +403,101 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceWithCustomHostnameKey Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + // ApiManagementCreateServiceWithDeveloperPortal + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateServiceWithDeveloperPortal() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceWithDeveloperPortal.json + // this example is just showing the usage of "ApiManagementService_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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApiManagementServiceResource + ApiManagementServiceCollection collection = resourceGroupResource.GetApiManagementServices(); + + // invoke the operation + string serviceName = "apimService1"; + ApiManagementServiceData data = new ApiManagementServiceData(new AzureLocation("South Central US"), new ApiManagementServiceSkuProperties(ApiManagementServiceSkuType.Developer, 1), "foo@contoso.com", "foo") + { + DeveloperPortalStatus = DeveloperPortalStatus.Enabled, + Tags = +{ +["Name"] = "Contoso", +["Test"] = "User", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, data); + 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}"); + } + + // ApiManagementCreateServiceWithNatGatewayEnabled + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateServiceWithNatGatewayEnabled() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceWithNatGatewayEnabled.json + // this example is just showing the usage of "ApiManagementService_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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApiManagementServiceResource + ApiManagementServiceCollection collection = resourceGroupResource.GetApiManagementServices(); + + // invoke the operation + string serviceName = "apimService1"; + ApiManagementServiceData data = new ApiManagementServiceData(new AzureLocation("East US"), new ApiManagementServiceSkuProperties(ApiManagementServiceSkuType.Premium, 1), "apim@autorestsdk.com", "autorestsdk") + { + NatGatewayState = NatGatewayState.Enabled, + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +["tag3"] = "value3", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, data); + 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}"); + } + // ApiManagementCreateServiceWithSystemCertificates [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateServiceWithSystemCertificates() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceWithSystemCertificates.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceWithSystemCertificates.json // this example is just showing the usage of "ApiManagementService_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 @@ -365,7 +507,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceWithSystemCertificate // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -407,7 +549,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceWithSystemCertificate [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateServiceWithUserAssignedIdentity() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateServiceWithUserAssignedIdentity.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceWithUserAssignedIdentity.json // this example is just showing the usage of "ApiManagementService_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 @@ -417,7 +559,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceWithUserAssignedIdent // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -433,7 +575,7 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceWithUserAssignedIdent { UserAssignedIdentities = { -[new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apimService1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apimService1")] = new UserAssignedIdentity(), }, }, Tags = @@ -453,12 +595,57 @@ public async Task CreateOrUpdate_ApiManagementCreateServiceWithUserAssignedIdent Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + // ApiManagementCreateServiceWithoutLegacyConfigurationApi + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateServiceWithoutLegacyConfigurationApi() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateServiceWithoutLegacyConfigurationApi.json + // this example is just showing the usage of "ApiManagementService_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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ApiManagementServiceResource + ApiManagementServiceCollection collection = resourceGroupResource.GetApiManagementServices(); + + // invoke the operation + string serviceName = "apimService1"; + ApiManagementServiceData data = new ApiManagementServiceData(new AzureLocation("Central US"), new ApiManagementServiceSkuProperties(ApiManagementServiceSkuType.Basic, 1), "apim@autorestsdk.com", "autorestsdk") + { + LegacyApi = LegacyApiState.Disabled, + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +["tag3"] = "value3", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, data); + 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}"); + } + // ApiManagementUndelete [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementUndelete() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUndelete.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUndelete.json // this example is just showing the usage of "ApiManagementService_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 @@ -468,7 +655,7 @@ public async Task CreateOrUpdate_ApiManagementUndelete() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -497,7 +684,7 @@ public async Task CreateOrUpdate_ApiManagementUndelete() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementServiceGetMultiRegionInternalVnet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetMultiRegionInternalVnet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetMultiRegionInternalVnet.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -507,7 +694,7 @@ public async Task Get_ApiManagementServiceGetMultiRegionInternalVnet() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -531,7 +718,7 @@ public async Task Get_ApiManagementServiceGetMultiRegionInternalVnet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementServiceGetMultiRegionInternalVnet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetMultiRegionInternalVnet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetMultiRegionInternalVnet.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -541,7 +728,7 @@ public async Task Exists_ApiManagementServiceGetMultiRegionInternalVnet() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -561,7 +748,7 @@ public async Task Exists_ApiManagementServiceGetMultiRegionInternalVnet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementServiceGetMultiRegionInternalVnet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetMultiRegionInternalVnet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetMultiRegionInternalVnet.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -571,7 +758,7 @@ public async Task GetIfExists_ApiManagementServiceGetMultiRegionInternalVnet() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -603,7 +790,7 @@ public async Task GetIfExists_ApiManagementServiceGetMultiRegionInternalVnet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementServiceGetService() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetService.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetService.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -613,7 +800,7 @@ public async Task Get_ApiManagementServiceGetService() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -637,7 +824,7 @@ public async Task Get_ApiManagementServiceGetService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementServiceGetService() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetService.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetService.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -647,7 +834,7 @@ public async Task Exists_ApiManagementServiceGetService() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -667,7 +854,7 @@ public async Task Exists_ApiManagementServiceGetService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementServiceGetService() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetService.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetService.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -677,7 +864,7 @@ public async Task GetIfExists_ApiManagementServiceGetService() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -709,7 +896,7 @@ public async Task GetIfExists_ApiManagementServiceGetService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementServiceGetServiceHavingMsi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetServiceHavingMsi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetServiceHavingMsi.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -719,7 +906,7 @@ public async Task Get_ApiManagementServiceGetServiceHavingMsi() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -743,7 +930,7 @@ public async Task Get_ApiManagementServiceGetServiceHavingMsi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementServiceGetServiceHavingMsi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetServiceHavingMsi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetServiceHavingMsi.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -753,7 +940,7 @@ public async Task Exists_ApiManagementServiceGetServiceHavingMsi() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -773,7 +960,7 @@ public async Task Exists_ApiManagementServiceGetServiceHavingMsi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementServiceGetServiceHavingMsi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetServiceHavingMsi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetServiceHavingMsi.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -783,7 +970,7 @@ public async Task GetIfExists_ApiManagementServiceGetServiceHavingMsi() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -815,7 +1002,7 @@ public async Task GetIfExists_ApiManagementServiceGetServiceHavingMsi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListServiceBySubscriptionAndResourceGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListServiceBySubscriptionAndResourceGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListServiceBySubscriptionAndResourceGroup.json // this example is just showing the usage of "ApiManagementService_ListByResourceGroup" 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 @@ -825,7 +1012,7 @@ public async Task GetAll_ApiManagementListServiceBySubscriptionAndResourceGroup( // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceResource.cs index 4406a35204d9..f3f195876d38 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementServiceResource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Threading.Tasks; using System.Xml; using Azure; @@ -20,12 +21,42 @@ namespace Azure.ResourceManager.ApiManagement.Samples { public partial class Sample_ApiManagementServiceResource { + // ApiManagementListPolicyRestrictions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAllPoliciesByService_ApiManagementListPolicyRestrictions() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementAllPolicies.json + // this example is just showing the usage of "AllPolicies_ListByService" 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 and iterate over the result + await foreach (AllPoliciesContract item in apiManagementService.GetAllPoliciesByServiceAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + // ApiManagementListApisByTags [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetApisByTags_ApiManagementListApisByTags() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApisByTags.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApisByTags.json // this example is just showing the usage of "Api_ListByTags" 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 @@ -35,7 +66,7 @@ public async Task GetApisByTags_ApiManagementListApisByTags() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -55,7 +86,7 @@ public async Task GetApisByTags_ApiManagementListApisByTags() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task PerformConnectivityCheckAsync_HTTPConnectivityCheck() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPerformConnectivityCheckHttpConnect.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPerformConnectivityCheckHttpConnect.json // this example is just showing the usage of "PerformConnectivityCheckAsync" 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 @@ -65,7 +96,7 @@ public async Task PerformConnectivityCheckAsync_HTTPConnectivityCheck() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -99,7 +130,7 @@ public async Task PerformConnectivityCheckAsync_HTTPConnectivityCheck() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task PerformConnectivityCheckAsync_TCPConnectivityCheck() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementPerformConnectivityCheck.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPerformConnectivityCheck.json // this example is just showing the usage of "PerformConnectivityCheckAsync" 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 @@ -109,7 +140,7 @@ public async Task PerformConnectivityCheckAsync_TCPConnectivityCheck() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -131,7 +162,7 @@ public async Task PerformConnectivityCheckAsync_TCPConnectivityCheck() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetContentTypes_ApiManagementListContentTypes() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListContentTypes.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListContentTypes.json // this example is just showing the usage of "ContentType_ListByService" 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 @@ -141,7 +172,7 @@ public async Task GetContentTypes_ApiManagementListContentTypes() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -161,7 +192,7 @@ public async Task GetContentTypes_ApiManagementListContentTypes() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetContentType_ApiManagementGetContentType() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetContentType.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetContentType.json // this example is just showing the usage of "ContentType_Get" 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 @@ -171,7 +202,7 @@ public async Task GetContentType_ApiManagementGetContentType() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -189,7 +220,7 @@ public async Task GetContentType_ApiManagementGetContentType() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateContentType_ApiManagementCreateContentType() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateContentType.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -199,7 +230,7 @@ public async Task CreateOrUpdateContentType_ApiManagementCreateContentType() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -207,7 +238,63 @@ public async Task CreateOrUpdateContentType_ApiManagementCreateContentType() // invoke the operation string contentTypeId = "page"; - ApiManagementContentType result = await apiManagementService.CreateOrUpdateContentTypeAsync(contentTypeId); + ApiManagementContentType apiManagementContentType = new ApiManagementContentType() + { + ContentTypeName = "Page", + Description = "A regular page", + Schema = BinaryData.FromObjectAsJson(new Dictionary() + { + ["additionalProperties"] = "false", + ["properties"] = new Dictionary() + { + ["en_us"] = new Dictionary() + { + ["type"] = "object", + ["additionalProperties"] = "false", + ["properties"] = new Dictionary() + { + ["description"] = new Dictionary() + { + ["type"] = "string", + ["description"] = "Page description. This property gets included in SEO attributes.", + ["indexed"] = "true", + ["title"] = "Description" + }, + ["documentId"] = new Dictionary() + { + ["type"] = "string", + ["description"] = "Reference to page content document.", + ["title"] = "Document ID" + }, + ["keywords"] = new Dictionary() + { + ["type"] = "string", + ["description"] = "Page keywords. This property gets included in SEO attributes.", + ["indexed"] = "true", + ["title"] = "Keywords" + }, + ["permalink"] = new Dictionary() + { + ["type"] = "string", + ["description"] = "Page permalink, e.g. '/about'.", + ["indexed"] = "true", + ["title"] = "Permalink" + }, + ["title"] = new Dictionary() + { + ["type"] = "string", + ["description"] = "Page title. This property gets included in SEO attributes.", + ["indexed"] = "true", + ["title"] = "Title" + } + }, + ["required"] = new object[] { "title", "permalink", "documentId" } + } + } + }), + Version = "1.0.0", + }; + ApiManagementContentType result = await apiManagementService.CreateOrUpdateContentTypeAsync(contentTypeId, apiManagementContentType); Console.WriteLine($"Succeeded: {result}"); } @@ -217,7 +304,7 @@ public async Task CreateOrUpdateContentType_ApiManagementCreateContentType() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteContentType_ApiManagementDeleteContentType() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteContentType.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteContentType.json // this example is just showing the usage of "ContentType_Delete" 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 @@ -227,7 +314,7 @@ public async Task DeleteContentType_ApiManagementDeleteContentType() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -246,7 +333,7 @@ public async Task DeleteContentType_ApiManagementDeleteContentType() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetContentItems_ApiManagementListContentTypeContentItems() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListContentTypeContentItems.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListContentTypeContentItems.json // this example is just showing the usage of "ContentItem_ListByService" 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 @@ -256,7 +343,7 @@ public async Task GetContentItems_ApiManagementListContentTypeContentItems() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -277,7 +364,7 @@ public async Task GetContentItems_ApiManagementListContentTypeContentItems() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetContentItemEntityTag_ApiManagementHeadContentTypeContentItem() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadContentTypeContentItem.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadContentTypeContentItem.json // this example is just showing the usage of "ContentItem_GetEntityTag" 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 @@ -287,7 +374,7 @@ public async Task GetContentItemEntityTag_ApiManagementHeadContentTypeContentIte // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -306,7 +393,7 @@ public async Task GetContentItemEntityTag_ApiManagementHeadContentTypeContentIte [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetContentItem_ApiManagementGetContentTypeContentItem() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetContentTypeContentItem.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetContentTypeContentItem.json // this example is just showing the usage of "ContentItem_Get" 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 @@ -316,7 +403,7 @@ public async Task GetContentItem_ApiManagementGetContentTypeContentItem() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -335,7 +422,7 @@ public async Task GetContentItem_ApiManagementGetContentTypeContentItem() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateContentItem_ApiManagementCreateContentTypeContentItem() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateContentTypeContentItem.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -345,7 +432,7 @@ public async Task CreateOrUpdateContentItem_ApiManagementCreateContentTypeConten // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -354,7 +441,20 @@ public async Task CreateOrUpdateContentItem_ApiManagementCreateContentTypeConten // invoke the operation string contentTypeId = "page"; string contentItemId = "4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8"; - ApiManagementContentItem result = await apiManagementService.CreateOrUpdateContentItemAsync(contentTypeId, contentItemId); + ApiManagementContentItem apiManagementContentItem = new ApiManagementContentItem() + { + Properties = +{ +["en_us"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["description"] = "Short story about the company.", +["documentId"] = "contentTypes/document/contentItems/4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8", +["keywords"] = "company, about", +["permalink"] = "/about", +["title"] = "About"}), +}, + }; + ApiManagementContentItem result = await apiManagementService.CreateOrUpdateContentItemAsync(contentTypeId, contentItemId, apiManagementContentItem); Console.WriteLine($"Succeeded: {result}"); } @@ -364,7 +464,7 @@ public async Task CreateOrUpdateContentItem_ApiManagementCreateContentTypeConten [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteContentItem_ApiManagementDeleteContentTypeContentItem() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteContentTypeContentItem.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteContentTypeContentItem.json // this example is just showing the usage of "ContentItem_Delete" 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 @@ -374,7 +474,7 @@ public async Task DeleteContentItem_ApiManagementDeleteContentTypeContentItem() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -394,7 +494,7 @@ public async Task DeleteContentItem_ApiManagementDeleteContentTypeContentItem() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAvailableApiManagementServiceSkus_ApiManagementListSKUsConsumption() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSKUs-Consumption.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListSKUs-Consumption.json // this example is just showing the usage of "ApiManagementServiceSkus_ListAvailableServiceSkus" 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 @@ -404,7 +504,7 @@ public async Task GetAvailableApiManagementServiceSkus_ApiManagementListSKUsCons // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -424,7 +524,7 @@ public async Task GetAvailableApiManagementServiceSkus_ApiManagementListSKUsCons [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAvailableApiManagementServiceSkus_ApiManagementListSKUsDedicated() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSKUs-Dedicated.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListSKUs-Dedicated.json // this example is just showing the usage of "ApiManagementServiceSkus_ListAvailableServiceSkus" 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 @@ -434,7 +534,7 @@ public async Task GetAvailableApiManagementServiceSkus_ApiManagementListSKUsDedi // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -454,7 +554,7 @@ public async Task GetAvailableApiManagementServiceSkus_ApiManagementListSKUsDedi [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Restore_ApiManagementRestoreService() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementRestoreWithAccessKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementRestoreWithAccessKey.json // this example is just showing the usage of "ApiManagementService_Restore" 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 @@ -464,7 +564,7 @@ public async Task Restore_ApiManagementRestoreService() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -491,7 +591,7 @@ public async Task Restore_ApiManagementRestoreService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Backup_ApiManagementBackupWithAccessKey() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackupWithAccessKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -501,7 +601,7 @@ public async Task Backup_ApiManagementBackupWithAccessKey() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -528,7 +628,7 @@ public async Task Backup_ApiManagementBackupWithAccessKey() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Backup_ApiManagementBackupWithSystemManagedIdentity() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackupWithSystemManagedIdentity.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -538,7 +638,7 @@ public async Task Backup_ApiManagementBackupWithSystemManagedIdentity() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -564,7 +664,7 @@ public async Task Backup_ApiManagementBackupWithSystemManagedIdentity() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Backup_ApiManagementBackupWithUserAssignedManagedIdentity() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementBackupWithUserAssignedManagedIdentity.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -574,7 +674,7 @@ public async Task Backup_ApiManagementBackupWithUserAssignedManagedIdentity() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -601,7 +701,7 @@ public async Task Backup_ApiManagementBackupWithUserAssignedManagedIdentity() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateServiceDisableTls10() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateServiceDisableTls10.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateServiceDisableTls10.json // this example is just showing the usage of "ApiManagementService_Update" 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 @@ -611,7 +711,7 @@ public async Task Update_ApiManagementUpdateServiceDisableTls10() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -640,7 +740,7 @@ public async Task Update_ApiManagementUpdateServiceDisableTls10() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateServicePublisherDetails() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateServicePublisherDetails.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateServicePublisherDetails.json // this example is just showing the usage of "ApiManagementService_Update" 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 @@ -650,7 +750,7 @@ public async Task Update_ApiManagementUpdateServicePublisherDetails() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -677,7 +777,7 @@ public async Task Update_ApiManagementUpdateServicePublisherDetails() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateServiceToNewVnetAndAvailabilityZones() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateServiceToNewVnetAndAZs.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateServiceToNewVnetAndAZs.json // this example is just showing the usage of "ApiManagementService_Update" 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 @@ -687,7 +787,7 @@ public async Task Update_ApiManagementUpdateServiceToNewVnetAndAvailabilityZones // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -701,10 +801,10 @@ public async Task Update_ApiManagementUpdateServiceToNewVnetAndAvailabilityZones { "1","2","3" }, - PublicIPAddressId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/publicip-apim-japan-east"), + PublicIPAddressId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/publicip-apim-japan-east"), VirtualNetworkConfiguration = new VirtualNetworkConfiguration() { - SubnetResourceId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-apim-japaneast/subnets/apim2"), + SubnetResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-apim-japaneast/subnets/apim2"), }, AdditionalLocations = { @@ -714,10 +814,10 @@ public async Task Update_ApiManagementUpdateServiceToNewVnetAndAvailabilityZones { "1","2","3" }, -PublicIPAddressId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/apim-australia-east-publicip"), +PublicIPAddressId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/apim-australia-east-publicip"), VirtualNetworkConfiguration = new VirtualNetworkConfiguration() { -SubnetResourceId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/apimaeavnet/subnets/default"), +SubnetResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/apimaeavnet/subnets/default"), }, } }, @@ -738,7 +838,7 @@ public async Task Update_ApiManagementUpdateServiceToNewVnetAndAvailabilityZones [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementServiceGetMultiRegionInternalVnet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetMultiRegionInternalVnet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetMultiRegionInternalVnet.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -748,7 +848,7 @@ public async Task Get_ApiManagementServiceGetMultiRegionInternalVnet() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -769,7 +869,7 @@ public async Task Get_ApiManagementServiceGetMultiRegionInternalVnet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementServiceGetService() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetService.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetService.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -779,7 +879,7 @@ public async Task Get_ApiManagementServiceGetService() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -800,7 +900,7 @@ public async Task Get_ApiManagementServiceGetService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementServiceGetServiceHavingMsi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetServiceHavingMsi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetServiceHavingMsi.json // this example is just showing the usage of "ApiManagementService_Get" 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 @@ -810,7 +910,7 @@ public async Task Get_ApiManagementServiceGetServiceHavingMsi() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -831,7 +931,7 @@ public async Task Get_ApiManagementServiceGetServiceHavingMsi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementServiceDeleteService() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceDeleteService.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceDeleteService.json // this example is just showing the usage of "ApiManagementService_Delete" 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 @@ -841,7 +941,7 @@ public async Task Delete_ApiManagementServiceDeleteService() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -853,12 +953,48 @@ public async Task Delete_ApiManagementServiceDeleteService() Console.WriteLine($"Succeeded"); } + // ApiManagementMigrateService + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateToStv2_ApiManagementMigrateService() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceMigrateToStv2.json + // this example is just showing the usage of "ApiManagementService_MigrateToStv2" 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 + MigrateToStv2Contract migrateToStv2Contract = new MigrateToStv2Contract() + { + Mode = MigrateToStv2Mode.PreserveIP, + }; + ArmOperation lro = await apiManagementService.MigrateToStv2Async(WaitUntil.Completed, migrateToStv2Contract: migrateToStv2Contract); + 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}"); + } + // ApiManagementListServiceBySubscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetApiManagementServices_ApiManagementListServiceBySubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListServiceBySubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListServiceBySubscription.json // this example is just showing the usage of "ApiManagementService_List" 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 @@ -868,7 +1004,7 @@ public async Task GetApiManagementServices_ApiManagementListServiceBySubscriptio // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); @@ -890,7 +1026,7 @@ public async Task GetApiManagementServices_ApiManagementListServiceBySubscriptio [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSsoToken_ApiManagementServiceGetSsoToken() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetSsoToken.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetSsoToken.json // this example is just showing the usage of "ApiManagementService_GetSsoToken" 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 @@ -900,7 +1036,7 @@ public async Task GetSsoToken_ApiManagementServiceGetSsoToken() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -917,7 +1053,7 @@ public async Task GetSsoToken_ApiManagementServiceGetSsoToken() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckApiManagementServiceNameAvailability_ApiManagementServiceCheckNameAvailability() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceCheckNameAvailability.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceCheckNameAvailability.json // this example is just showing the usage of "ApiManagementService_CheckNameAvailability" 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 @@ -927,7 +1063,7 @@ public async Task CheckApiManagementServiceNameAvailability_ApiManagementService // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); @@ -943,7 +1079,7 @@ public async Task CheckApiManagementServiceNameAvailability_ApiManagementService [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetApiManagementServiceDomainOwnershipIdentifier_ApiManagementServiceGetDomainOwnershipIdentifier() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetDomainOwnershipIdentifier.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetDomainOwnershipIdentifier.json // this example is just showing the usage of "ApiManagementService_GetDomainOwnershipIdentifier" 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 @@ -953,7 +1089,7 @@ public async Task GetApiManagementServiceDomainOwnershipIdentifier_ApiManagement // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); @@ -968,7 +1104,7 @@ public async Task GetApiManagementServiceDomainOwnershipIdentifier_ApiManagement [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ApplyNetworkConfigurationUpdates_ApiManagementApplyNetworkConfigurationUpdates() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementApplyNetworkConfigurationUpdates.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -978,7 +1114,7 @@ public async Task ApplyNetworkConfigurationUpdates_ApiManagementApplyNetworkConf // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1004,7 +1140,7 @@ public async Task ApplyNetworkConfigurationUpdates_ApiManagementApplyNetworkConf [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkStatuses_ApiManagementServiceGetNetworkStatus() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetNetworkStatus.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetNetworkStatus.json // this example is just showing the usage of "NetworkStatus_ListByService" 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 @@ -1014,7 +1150,7 @@ public async Task GetNetworkStatuses_ApiManagementServiceGetNetworkStatus() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1034,7 +1170,7 @@ public async Task GetNetworkStatuses_ApiManagementServiceGetNetworkStatus() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkStatusByLocation_ApiManagementServiceGetNetworkStatusByLocation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetNetworkStatusByLocation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetNetworkStatusByLocation.json // this example is just showing the usage of "NetworkStatus_ListByLocation" 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 @@ -1044,7 +1180,7 @@ public async Task GetNetworkStatusByLocation_ApiManagementServiceGetNetworkStatu // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1062,7 +1198,7 @@ public async Task GetNetworkStatusByLocation_ApiManagementServiceGetNetworkStatu [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetOutboundNetworkDependenciesEndpoints_ApiManagementServiceGetOutboundNetworkDependenciesEndpoints() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementServiceGetOutboundNetworkDependenciesEndpoints.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementServiceGetOutboundNetworkDependenciesEndpoints.json // this example is just showing the usage of "OutboundNetworkDependenciesEndpoints_ListByService" 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 @@ -1072,7 +1208,7 @@ public async Task GetOutboundNetworkDependenciesEndpoints_ApiManagementServiceGe // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1092,7 +1228,7 @@ public async Task GetOutboundNetworkDependenciesEndpoints_ApiManagementServiceGe [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetPolicyDescriptions_ApiManagementListPolicyDescriptions() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPolicyDescriptions.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPolicyDescriptions.json // this example is just showing the usage of "PolicyDescription_ListByService" 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 @@ -1102,7 +1238,7 @@ public async Task GetPolicyDescriptions_ApiManagementListPolicyDescriptions() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1118,12 +1254,40 @@ public async Task GetPolicyDescriptions_ApiManagementListPolicyDescriptions() Console.WriteLine($"Succeeded"); } + // ApiManagementListPolicyRestrictions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ByServicePolicyRestrictionValidation_ApiManagementListPolicyRestrictions() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementValidatePolicies.json + // this example is just showing the usage of "PolicyRestrictionValidations_ByService" 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 + ArmOperation lro = await apiManagementService.ByServicePolicyRestrictionValidationAsync(WaitUntil.Completed); + GitOperationResultContractData result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + // ApiManagementListPortalSettings [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetPortalSettings_ApiManagementListPortalSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListPortalSettings.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPortalSettings.json // this example is just showing the usage of "PortalSettings_ListByService" 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 @@ -1133,7 +1297,7 @@ public async Task GetPortalSettings_ApiManagementListPortalSettings() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1153,7 +1317,7 @@ public async Task GetPortalSettings_ApiManagementListPortalSettings() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetProductsByTags_ApiManagementListProductsByTags() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductsByTags.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListProductsByTags.json // this example is just showing the usage of "Product_ListByTags" 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 @@ -1163,7 +1327,7 @@ public async Task GetProductsByTags_ApiManagementListProductsByTags() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1183,7 +1347,7 @@ public async Task GetProductsByTags_ApiManagementListProductsByTags() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetQuotaByCounterKeys_ApiManagementGetQuotaCounterKeys() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeys.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetQuotaCounterKeys.json // this example is just showing the usage of "QuotaByCounterKeys_ListByService" 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 @@ -1193,7 +1357,7 @@ public async Task GetQuotaByCounterKeys_ApiManagementGetQuotaCounterKeys() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1214,7 +1378,7 @@ public async Task GetQuotaByCounterKeys_ApiManagementGetQuotaCounterKeys() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task UpdateQuotaByCounterKeys_ApiManagementUpdateQuotaCounterKey() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateQuotaCounterKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateQuotaCounterKey.json // this example is just showing the usage of "QuotaByCounterKeys_Update" 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 @@ -1224,7 +1388,7 @@ public async Task UpdateQuotaByCounterKeys_ApiManagementUpdateQuotaCounterKey() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1250,7 +1414,7 @@ public async Task UpdateQuotaByCounterKeys_ApiManagementUpdateQuotaCounterKey() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetQuotaByPeriodKey_ApiManagementGetQuotaCounterKeysByQuotaPeriod() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeysByQuotaPeriod.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetQuotaCounterKeysByQuotaPeriod.json // this example is just showing the usage of "QuotaByPeriodKeys_Get" 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 @@ -1260,7 +1424,7 @@ public async Task GetQuotaByPeriodKey_ApiManagementGetQuotaCounterKeysByQuotaPer // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1279,7 +1443,7 @@ public async Task GetQuotaByPeriodKey_ApiManagementGetQuotaCounterKeysByQuotaPer [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task UpdateQuotaByPeriodKey_ApiManagementUpdateQuotaCounterKeyByQuotaPeriod() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateQuotaCounterKeyByQuotaPeriod.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateQuotaCounterKeyByQuotaPeriod.json // this example is just showing the usage of "QuotaByPeriodKeys_Update" 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 @@ -1289,7 +1453,7 @@ public async Task UpdateQuotaByPeriodKey_ApiManagementUpdateQuotaCounterKeyByQuo // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1313,7 +1477,7 @@ public async Task UpdateQuotaByPeriodKey_ApiManagementUpdateQuotaCounterKeyByQuo [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetRegions_ApiManagementListRegions() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListRegions.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListRegions.json // this example is just showing the usage of "Region_ListByService" 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 @@ -1323,7 +1487,7 @@ public async Task GetRegions_ApiManagementListRegions() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1343,7 +1507,7 @@ public async Task GetRegions_ApiManagementListRegions() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReportsByApi_ApiManagementGetReportsByApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetReportsByApi.json // this example is just showing the usage of "Reports_ListByApi" 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 @@ -1353,7 +1517,7 @@ public async Task GetReportsByApi_ApiManagementGetReportsByApi() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1374,7 +1538,7 @@ public async Task GetReportsByApi_ApiManagementGetReportsByApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReportsByUser_ApiManagementGetReportsByUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetReportsByUser.json // this example is just showing the usage of "Reports_ListByUser" 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 @@ -1384,7 +1548,7 @@ public async Task GetReportsByUser_ApiManagementGetReportsByUser() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1405,7 +1569,7 @@ public async Task GetReportsByUser_ApiManagementGetReportsByUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReportsByOperation_ApiManagementGetReportsByOperation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByOperation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetReportsByOperation.json // this example is just showing the usage of "Reports_ListByOperation" 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 @@ -1415,7 +1579,7 @@ public async Task GetReportsByOperation_ApiManagementGetReportsByOperation() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1436,7 +1600,7 @@ public async Task GetReportsByOperation_ApiManagementGetReportsByOperation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReportsByProduct_ApiManagementGetReportsByProduct() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByProduct.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetReportsByProduct.json // this example is just showing the usage of "Reports_ListByProduct" 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 @@ -1446,7 +1610,7 @@ public async Task GetReportsByProduct_ApiManagementGetReportsByProduct() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1467,7 +1631,7 @@ public async Task GetReportsByProduct_ApiManagementGetReportsByProduct() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReportsByGeo_ApiManagementGetReportsByGeo() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByGeo.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetReportsByGeo.json // this example is just showing the usage of "Reports_ListByGeo" 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 @@ -1477,7 +1641,7 @@ public async Task GetReportsByGeo_ApiManagementGetReportsByGeo() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1498,7 +1662,7 @@ public async Task GetReportsByGeo_ApiManagementGetReportsByGeo() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReportsBySubscription_ApiManagementGetReportsBySubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsBySubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetReportsBySubscription.json // this example is just showing the usage of "Reports_ListBySubscription" 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 @@ -1508,7 +1672,7 @@ public async Task GetReportsBySubscription_ApiManagementGetReportsBySubscription // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1529,7 +1693,7 @@ public async Task GetReportsBySubscription_ApiManagementGetReportsBySubscription [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReportsByTime_ApiManagementGetReportsByTime() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByTime.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetReportsByTime.json // this example is just showing the usage of "Reports_ListByTime" 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 @@ -1539,7 +1703,7 @@ public async Task GetReportsByTime_ApiManagementGetReportsByTime() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1561,7 +1725,7 @@ public async Task GetReportsByTime_ApiManagementGetReportsByTime() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReportsByRequest_ApiManagementGetReportsByRequest() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetReportsByRequest.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetReportsByRequest.json // this example is just showing the usage of "Reports_ListByRequest" 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 @@ -1571,7 +1735,7 @@ public async Task GetReportsByRequest_ApiManagementGetReportsByRequest() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1592,7 +1756,7 @@ public async Task GetReportsByRequest_ApiManagementGetReportsByRequest() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetTagResources_ApiManagementListTagResources() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTagResources.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListTagResources.json // this example is just showing the usage of "TagResource_ListByService" 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 @@ -1602,7 +1766,7 @@ public async Task GetTagResources_ApiManagementListTagResources() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1622,7 +1786,7 @@ public async Task GetTagResources_ApiManagementListTagResources() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeployTenantConfiguration_ApiManagementTenantConfigurationDeploy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantConfigurationDeploy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementTenantConfigurationDeploy.json // this example is just showing the usage of "TenantConfiguration_Deploy" 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 @@ -1632,7 +1796,7 @@ public async Task DeployTenantConfiguration_ApiManagementTenantConfigurationDepl // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1655,7 +1819,7 @@ public async Task DeployTenantConfiguration_ApiManagementTenantConfigurationDepl [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task SaveTenantConfiguration_ApiManagementTenantConfigurationSave() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantConfigurationSave.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementTenantConfigurationSave.json // this example is just showing the usage of "TenantConfiguration_Save" 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 @@ -1665,7 +1829,7 @@ public async Task SaveTenantConfiguration_ApiManagementTenantConfigurationSave() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1688,7 +1852,7 @@ public async Task SaveTenantConfiguration_ApiManagementTenantConfigurationSave() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ValidateTenantConfiguration_ApiManagementTenantConfigurationValidate() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantConfigurationValidate.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementTenantConfigurationValidate.json // this example is just showing the usage of "TenantConfiguration_Validate" 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 @@ -1698,7 +1862,7 @@ public async Task ValidateTenantConfiguration_ApiManagementTenantConfigurationVa // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -1721,7 +1885,7 @@ public async Task ValidateTenantConfiguration_ApiManagementTenantConfigurationVa [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetTenantConfigurationSyncState_ApiManagementTenantAccessSyncState() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessSyncState.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementTenantAccessSyncState.json // this example is just showing the usage of "TenantConfiguration_GetSyncState" 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 @@ -1731,7 +1895,7 @@ public async Task GetTenantConfigurationSyncState_ApiManagementTenantAccessSyncS // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionCollection.cs index f45fba3ab2fc..bf87c7137437 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementSubscriptionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListSubscriptions() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSubscriptions.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListSubscriptions.json // this example is just showing the usage of "Subscription_List" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListSubscriptions() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListSubscriptions() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetSubscription.json // this example is just showing the usage of "Subscription_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetSubscription() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetSubscription.json // this example is just showing the usage of "Subscription_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetSubscription() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetSubscription.json // this example is just showing the usage of "Subscription_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetSubscription() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateSubscription.json // this example is just showing the usage of "Subscription_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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateSubscription() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -190,13 +190,13 @@ public async Task CreateOrUpdate_ApiManagementCreateSubscription() // invoke the operation string sid = "testsub"; - ApiManagementSubscriptionCreateOrUpdateContent content = new ApiManagementSubscriptionCreateOrUpdateContent() + SubscriptionCreateParameters subscriptionCreateParameters = new SubscriptionCreateParameters() { - OwnerId = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7", - Scope = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002", + OwnerId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7", + Scope = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002", DisplayName = "testsub", }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sid, content); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sid, subscriptionCreateParameters); ApiManagementSubscriptionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionResource.cs index 9b5c5520c08e..5d7169459518 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementSubscriptionResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementSubscriptionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadSubscription.json // this example is just showing the usage of "Subscription_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadSubscription() // this example assumes you already have this ApiManagementSubscriptionResource created on azure // for more information of creating ApiManagementSubscriptionResource, please refer to the document of ApiManagementSubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string sid = "5931a769d8d14f0ad8ce13b8"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetSubscription.json // this example is just showing the usage of "Subscription_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetSubscription() // this example assumes you already have this ApiManagementSubscriptionResource created on azure // for more information of creating ApiManagementSubscriptionResource, please refer to the document of ApiManagementSubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string sid = "5931a769d8d14f0ad8ce13b8"; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateSubscription.json // this example is just showing the usage of "Subscription_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateSubscription() // this example assumes you already have this ApiManagementSubscriptionResource created on azure // for more information of creating ApiManagementSubscriptionResource, please refer to the document of ApiManagementSubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string sid = "testsub"; @@ -102,11 +102,11 @@ public async Task Update_ApiManagementUpdateSubscription() // invoke the operation ETag ifMatch = new ETag("*"); - ApiManagementSubscriptionPatch patch = new ApiManagementSubscriptionPatch() + SubscriptionUpdateParameters subscriptionUpdateParameters = new SubscriptionUpdateParameters() { DisplayName = "testsub", }; - ApiManagementSubscriptionResource result = await apiManagementSubscription.UpdateAsync(ifMatch, patch); + ApiManagementSubscriptionResource result = await apiManagementSubscription.UpdateAsync(ifMatch, subscriptionUpdateParameters); // 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 @@ -120,7 +120,7 @@ public async Task Update_ApiManagementUpdateSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteSubscription.json // this example is just showing the usage of "Subscription_Delete" 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 @@ -130,7 +130,7 @@ public async Task Delete_ApiManagementDeleteSubscription() // this example assumes you already have this ApiManagementSubscriptionResource created on azure // for more information of creating ApiManagementSubscriptionResource, please refer to the document of ApiManagementSubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string sid = "testsub"; @@ -149,7 +149,7 @@ public async Task Delete_ApiManagementDeleteSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegeneratePrimaryKey_ApiManagementSubscriptionRegeneratePrimaryKey() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementSubscriptionRegeneratePrimaryKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementSubscriptionRegeneratePrimaryKey.json // this example is just showing the usage of "Subscription_RegeneratePrimaryKey" 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 @@ -159,7 +159,7 @@ public async Task RegeneratePrimaryKey_ApiManagementSubscriptionRegeneratePrimar // this example assumes you already have this ApiManagementSubscriptionResource created on azure // for more information of creating ApiManagementSubscriptionResource, please refer to the document of ApiManagementSubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string sid = "testsub"; @@ -177,7 +177,7 @@ public async Task RegeneratePrimaryKey_ApiManagementSubscriptionRegeneratePrimar [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegenerateSecondaryKey_ApiManagementSubscriptionRegenerateSecondaryKey() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementSubscriptionRegenerateSecondaryKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementSubscriptionRegenerateSecondaryKey.json // this example is just showing the usage of "Subscription_RegenerateSecondaryKey" 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 @@ -187,7 +187,7 @@ public async Task RegenerateSecondaryKey_ApiManagementSubscriptionRegenerateSeco // this example assumes you already have this ApiManagementSubscriptionResource created on azure // for more information of creating ApiManagementSubscriptionResource, please refer to the document of ApiManagementSubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string sid = "testsub"; @@ -205,7 +205,7 @@ public async Task RegenerateSecondaryKey_ApiManagementSubscriptionRegenerateSeco [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSecrets_ApiManagementSubscriptionListSecrets() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementSubscriptionListSecrets.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementSubscriptionListSecrets.json // this example is just showing the usage of "Subscription_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 @@ -215,7 +215,7 @@ public async Task GetSecrets_ApiManagementSubscriptionListSecrets() // this example assumes you already have this ApiManagementSubscriptionResource created on azure // for more information of creating ApiManagementSubscriptionResource, please refer to the document of ApiManagementSubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string sid = "5931a769d8d14f0ad8ce13b8"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagCollection.cs index 72d858c19c0c..a35ecb2b3928 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementTagCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListTags() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTags.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListTags.json // this example is just showing the usage of "Tag_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListTags() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListTags() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTag.json // this example is just showing the usage of "Tag_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTag.json // this example is just showing the usage of "Tag_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTag.json // this example is just showing the usage of "Tag_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateTag.json // this example is just showing the usage of "Tag_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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagResource.cs index b157348c499e..da8abbcc6fce 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTagResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementTagResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityState_ApiManagementHeadTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadTag.json // this example is just showing the usage of "Tag_GetEntityState" 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 @@ -33,7 +33,7 @@ public async Task GetEntityState_ApiManagementHeadTag() // this example assumes you already have this ApiManagementTagResource created on azure // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string tagId = "59306a29e4bbd510dc24e5f9"; @@ -51,7 +51,7 @@ public async Task GetEntityState_ApiManagementHeadTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTag.json // this example is just showing the usage of "Tag_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetTag() // this example assumes you already have this ApiManagementTagResource created on azure // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string tagId = "59306a29e4bbd510dc24e5f9"; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateTag.json // this example is just showing the usage of "Tag_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateTag() // this example assumes you already have this ApiManagementTagResource created on azure // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string tagId = "temptag"; @@ -120,7 +120,7 @@ public async Task Update_ApiManagementUpdateTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteTag.json // this example is just showing the usage of "Tag_Delete" 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 @@ -130,7 +130,7 @@ public async Task Delete_ApiManagementDeleteTag() // this example assumes you already have this ApiManagementTagResource created on azure // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string tagId = "tagId1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingCollection.cs index e1ed9210e5ca..fc693f23cf2f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementTenantSettingCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListTenantSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTenantSettings.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListTenantSettings.json // this example is just showing the usage of "TenantSettings_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListTenantSettings() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListTenantSettings() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTenantSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantSettings.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantSettings.json // this example is just showing the usage of "TenantSettings_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetTenantSettings() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetTenantSettings() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetTenantSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantSettings.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantSettings.json // this example is just showing the usage of "TenantSettings_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetTenantSettings() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetTenantSettings() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetTenantSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantSettings.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantSettings.json // this example is just showing the usage of "TenantSettings_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetTenantSettings() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingResource.cs index 8a3bc4a96d31..670ee75c23fd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementTenantSettingResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementTenantSettingResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTenantSettings() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantSettings.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantSettings.json // this example is just showing the usage of "TenantSettings_Get" 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 @@ -32,7 +32,7 @@ public async Task Get_ApiManagementGetTenantSettings() // this example assumes you already have this ApiManagementTenantSettingResource created on azure // for more information of creating ApiManagementTenantSettingResource, please refer to the document of ApiManagementTenantSettingResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; SettingsType settingsType = SettingsType.Public; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserCollection.cs index 374ddef4b0ae..ef2d77a8a5b3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementUserCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListUsers() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUsers.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListUsers.json // this example is just showing the usage of "User_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListUsers() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListUsers() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetUser.json // this example is just showing the usage of "User_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetUser() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetUser.json // this example is just showing the usage of "User_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetUser() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetUser.json // this example is just showing the usage of "User_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetUser() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateUser.json // this example is just showing the usage of "User_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 @@ -179,7 +179,7 @@ public async Task CreateOrUpdate_ApiManagementCreateUser() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserResource.cs index 63497d08bb33..ca7b8d36e18e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiManagementUserResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadUser.json // this example is just showing the usage of "User_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadUser() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "5931a75ae4bbd512a88c680b"; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetUser.json // this example is just showing the usage of "User_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetUser() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "5931a75ae4bbd512a88c680b"; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateUser.json // this example is just showing the usage of "User_Update" 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 @@ -93,7 +93,7 @@ public async Task Update_ApiManagementUpdateUser() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "5931a75ae4bbd512a88c680b"; @@ -122,7 +122,7 @@ public async Task Update_ApiManagementUpdateUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteUser.json // this example is just showing the usage of "User_Delete" 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 @@ -132,7 +132,7 @@ public async Task Delete_ApiManagementDeleteUser() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "5931a75ae4bbd512288c680b"; @@ -151,7 +151,7 @@ public async Task Delete_ApiManagementDeleteUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GenerateSsoUri_ApiManagementUserGenerateSsoUrl() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUserGenerateSsoUrl.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUserGenerateSsoUrl.json // this example is just showing the usage of "User_GenerateSsoUrl" 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 @@ -161,7 +161,7 @@ public async Task GenerateSsoUri_ApiManagementUserGenerateSsoUrl() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "57127d485157a511ace86ae7"; @@ -179,7 +179,7 @@ public async Task GenerateSsoUri_ApiManagementUserGenerateSsoUrl() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSharedAccessToken_ApiManagementUserToken() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUserToken.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUserToken.json // this example is just showing the usage of "User_GetSharedAccessToken" 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 @@ -189,7 +189,7 @@ public async Task GetSharedAccessToken_ApiManagementUserToken() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "userId1718"; @@ -212,7 +212,7 @@ public async Task GetSharedAccessToken_ApiManagementUserToken() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetUserGroups_ApiManagementListUserGroups() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUserGroups.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListUserGroups.json // this example is just showing the usage of "UserGroup_List" 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 @@ -222,7 +222,7 @@ public async Task GetUserGroups_ApiManagementListUserGroups() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "57681833a40f7eb6c49f6acf"; @@ -230,13 +230,10 @@ public async Task GetUserGroups_ApiManagementListUserGroups() ApiManagementUserResource apiManagementUser = client.GetApiManagementUserResource(apiManagementUserResourceId); // invoke the operation and iterate over the result - await foreach (ApiManagementGroupResource item in apiManagementUser.GetUserGroupsAsync()) + await foreach (ApiManagementGroupData item in apiManagementUser.GetUserGroupsAsync()) { - // the variable item 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 - ApiManagementGroupData resourceData = item.Data; // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded on id: {item.Id}"); } Console.WriteLine($"Succeeded"); @@ -247,7 +244,7 @@ public async Task GetUserGroups_ApiManagementListUserGroups() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetUserIdentities_ApiManagementListUserIdentities() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUserIdentities.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListUserIdentities.json // this example is just showing the usage of "UserIdentities_List" 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 @@ -257,7 +254,7 @@ public async Task GetUserIdentities_ApiManagementListUserIdentities() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "57f2af53bb17172280f44057"; @@ -278,7 +275,7 @@ public async Task GetUserIdentities_ApiManagementListUserIdentities() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task SendUserConfirmationPassword_ApiManagementUserConfirmationPasswordSend() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUserConfirmationPasswordSend.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUserConfirmationPasswordSend.json // this example is just showing the usage of "UserConfirmationPassword_Send" 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 @@ -288,7 +285,7 @@ public async Task SendUserConfirmationPassword_ApiManagementUserConfirmationPass // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "57127d485157a511ace86ae7"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionCollection.cs index 9fc940a8fd33..b05cabd72ab7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiManagementUserSubscriptionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListUserSubscriptions() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListUserSubscriptions.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListUserSubscriptions.json // this example is just showing the usage of "UserSubscription_List" 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 @@ -32,7 +32,7 @@ public async Task GetAll_ApiManagementListUserSubscriptions() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "57681833a40f7eb6c49f6acf"; @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListUserSubscriptions() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetUserSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUserSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetUserSubscription.json // this example is just showing the usage of "UserSubscription_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetUserSubscription() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "1"; @@ -96,7 +96,7 @@ public async Task Get_ApiManagementGetUserSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetUserSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUserSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetUserSubscription.json // this example is just showing the usage of "UserSubscription_Get" 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 @@ -106,7 +106,7 @@ public async Task Exists_ApiManagementGetUserSubscription() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "1"; @@ -128,7 +128,7 @@ public async Task Exists_ApiManagementGetUserSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetUserSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUserSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetUserSubscription.json // this example is just showing the usage of "UserSubscription_Get" 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 @@ -138,7 +138,7 @@ public async Task GetIfExists_ApiManagementGetUserSubscription() // this example assumes you already have this ApiManagementUserResource created on azure // for more information of creating ApiManagementUserResource, please refer to the document of ApiManagementUserResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionResource.cs index 30c9477e3180..d14d0db49fdf 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementUserSubscriptionResource.cs @@ -21,7 +21,7 @@ public partial class Sample_ApiManagementUserSubscriptionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetUserSubscription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetUserSubscription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetUserSubscription.json // this example is just showing the usage of "UserSubscription_Get" 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 @@ -31,7 +31,7 @@ public async Task Get_ApiManagementGetUserSubscription() // this example assumes you already have this ApiManagementUserSubscriptionResource created on azure // for more information of creating ApiManagementUserSubscriptionResource, please refer to the document of ApiManagementUserSubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string userId = "1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyCollection.cs index 3fa98f2122bb..db6409065051 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiOperationPolicyCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiOperationPolicies() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperationPolicies.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiOperationPolicies.json // this example is just showing the usage of "ApiOperationPolicy_ListByOperation" 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 @@ -31,18 +31,18 @@ public async Task GetAll_ApiManagementListApiOperationPolicies() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "599e2953193c3c0bd0b3e2fa"; string operationId = "599e29ab193c3c0bd0b3e2fb"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationPolicyResource - ApiOperationPolicyCollection collection = apiOperation.GetApiOperationPolicies(); + ApiOperationPolicyCollection collection = serviceApiOperation.GetApiOperationPolicies(); // invoke the operation and iterate over the result await foreach (ApiOperationPolicyResource item in collection.GetAllAsync()) @@ -62,7 +62,7 @@ public async Task GetAll_ApiManagementListApiOperationPolicies() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiOperationPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationPolicy.json // this example is just showing the usage of "ApiOperationPolicy_Get" 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 @@ -70,18 +70,18 @@ public async Task Get_ApiManagementGetApiOperationPolicy() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b539c53f5b0062040001"; string operationId = "5600b53ac53f5b0062080006"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationPolicyResource - ApiOperationPolicyCollection collection = apiOperation.GetApiOperationPolicies(); + ApiOperationPolicyCollection collection = serviceApiOperation.GetApiOperationPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -99,7 +99,7 @@ public async Task Get_ApiManagementGetApiOperationPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiOperationPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationPolicy.json // this example is just showing the usage of "ApiOperationPolicy_Get" 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 @@ -107,18 +107,18 @@ public async Task Exists_ApiManagementGetApiOperationPolicy() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b539c53f5b0062040001"; string operationId = "5600b53ac53f5b0062080006"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationPolicyResource - ApiOperationPolicyCollection collection = apiOperation.GetApiOperationPolicies(); + ApiOperationPolicyCollection collection = serviceApiOperation.GetApiOperationPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -132,7 +132,7 @@ public async Task Exists_ApiManagementGetApiOperationPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiOperationPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationPolicy.json // this example is just showing the usage of "ApiOperationPolicy_Get" 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 @@ -140,18 +140,18 @@ public async Task GetIfExists_ApiManagementGetApiOperationPolicy() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b539c53f5b0062040001"; string operationId = "5600b53ac53f5b0062080006"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationPolicyResource - ApiOperationPolicyCollection collection = apiOperation.GetApiOperationPolicies(); + ApiOperationPolicyCollection collection = serviceApiOperation.GetApiOperationPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -177,7 +177,7 @@ public async Task GetIfExists_ApiManagementGetApiOperationPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiOperationPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperationPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -185,18 +185,18 @@ public async Task CreateOrUpdate_ApiManagementCreateApiOperationPolicy() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b57e7e8880006a040001"; string operationId = "5600b57e7e8880006a080001"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationPolicyResource - ApiOperationPolicyCollection collection = apiOperation.GetApiOperationPolicies(); + ApiOperationPolicyCollection collection = serviceApiOperation.GetApiOperationPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyResource.cs index eff62ec900d2..65ada37401f1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationPolicyResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiOperationPolicyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiOperationPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiOperationPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiOperationPolicy.json // this example is just showing the usage of "ApiOperationPolicy_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadApiOperationPolicy() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b539c53f5b0062040001"; @@ -53,7 +53,7 @@ public async Task GetEntityTag_ApiManagementHeadApiOperationPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiOperationPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationPolicy.json // this example is just showing the usage of "ApiOperationPolicy_Get" 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 @@ -63,7 +63,7 @@ public async Task Get_ApiManagementGetApiOperationPolicy() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b539c53f5b0062040001"; @@ -87,7 +87,7 @@ public async Task Get_ApiManagementGetApiOperationPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateApiOperationPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperationPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -97,7 +97,7 @@ public async Task Update_ApiManagementCreateApiOperationPolicy() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b57e7e8880006a040001"; @@ -128,7 +128,7 @@ public async Task Update_ApiManagementCreateApiOperationPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiOperationPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiOperationPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiOperationPolicy.json // this example is just showing the usage of "ApiOperationPolicy_Delete" 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 @@ -138,7 +138,7 @@ public async Task Delete_ApiManagementDeleteApiOperationPolicy() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "testapi"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagCollection.cs index 6218fa6e32af..854cf9c01384 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiOperationTagCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiOperationTags() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperationTags.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiOperationTags.json // this example is just showing the usage of "Tag_ListByOperation" 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 @@ -30,18 +30,18 @@ public async Task GetAll_ApiManagementListApiOperationTags() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; string operationId = "57d2ef278aa04f0888cba3f6"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationTagResource - ApiOperationTagCollection collection = apiOperation.GetApiOperationTags(); + ApiOperationTagCollection collection = serviceApiOperation.GetApiOperationTags(); // invoke the operation and iterate over the result await foreach (ApiOperationTagResource item in collection.GetAllAsync()) @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListApiOperationTags() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiOperationTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationTag.json // this example is just showing the usage of "Tag_GetByOperation" 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 @@ -69,18 +69,18 @@ public async Task Get_ApiManagementGetApiOperationTag() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; string operationId = "59d6bb8f1f7fab13dc67ec9a"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationTagResource - ApiOperationTagCollection collection = apiOperation.GetApiOperationTags(); + ApiOperationTagCollection collection = serviceApiOperation.GetApiOperationTags(); // invoke the operation string tagId = "59306a29e4bbd510dc24e5f9"; @@ -98,7 +98,7 @@ public async Task Get_ApiManagementGetApiOperationTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiOperationTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationTag.json // this example is just showing the usage of "Tag_GetByOperation" 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 @@ -106,18 +106,18 @@ public async Task Exists_ApiManagementGetApiOperationTag() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; string operationId = "59d6bb8f1f7fab13dc67ec9a"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationTagResource - ApiOperationTagCollection collection = apiOperation.GetApiOperationTags(); + ApiOperationTagCollection collection = serviceApiOperation.GetApiOperationTags(); // invoke the operation string tagId = "59306a29e4bbd510dc24e5f9"; @@ -131,7 +131,7 @@ public async Task Exists_ApiManagementGetApiOperationTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiOperationTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationTag.json // this example is just showing the usage of "Tag_GetByOperation" 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 @@ -139,18 +139,18 @@ public async Task GetIfExists_ApiManagementGetApiOperationTag() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; string operationId = "59d6bb8f1f7fab13dc67ec9a"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationTagResource - ApiOperationTagCollection collection = apiOperation.GetApiOperationTags(); + ApiOperationTagCollection collection = serviceApiOperation.GetApiOperationTags(); // invoke the operation string tagId = "59306a29e4bbd510dc24e5f9"; @@ -176,7 +176,7 @@ public async Task GetIfExists_ApiManagementGetApiOperationTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiOperationTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperationTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -184,18 +184,18 @@ public async Task CreateOrUpdate_ApiManagementCreateApiOperationTag() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5931a75ae4bbd512a88c680b"; string operationId = "5931a75ae4bbd512a88c680a"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // get the collection of this ApiOperationTagResource - ApiOperationTagCollection collection = apiOperation.GetApiOperationTags(); + ApiOperationTagCollection collection = serviceApiOperation.GetApiOperationTags(); // invoke the operation string tagId = "tagId1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagResource.cs index 2514e5e3921e..32d028864988 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationTagResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiOperationTagResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityStateByOperation_ApiManagementHeadApiOperationTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiOperationTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiOperationTag.json // this example is just showing the usage of "Tag_GetEntityStateByOperation" 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 @@ -32,7 +32,7 @@ public async Task GetEntityStateByOperation_ApiManagementHeadApiOperationTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; @@ -52,7 +52,7 @@ public async Task GetEntityStateByOperation_ApiManagementHeadApiOperationTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiOperationTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationTag.json // this example is just showing the usage of "Tag_GetByOperation" 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 @@ -62,7 +62,7 @@ public async Task Get_ApiManagementGetApiOperationTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; @@ -86,7 +86,7 @@ public async Task Get_ApiManagementGetApiOperationTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateApiOperationTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperationTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -96,7 +96,7 @@ public async Task Update_ApiManagementCreateApiOperationTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5931a75ae4bbd512a88c680b"; @@ -121,7 +121,7 @@ public async Task Update_ApiManagementCreateApiOperationTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiOperationTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiOperationTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiOperationTag.json // this example is just showing the usage of "Tag_DetachFromOperation" 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 @@ -131,7 +131,7 @@ public async Task Delete_ApiManagementDeleteApiOperationTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d5b28d1f7fab116c282650"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyCollection.cs index 69a997dc8545..5a744309a4f4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiPolicyCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiPolicies() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiPolicies.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiPolicies.json // this example is just showing the usage of "ApiPolicy_ListByApi" 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 @@ -31,17 +31,17 @@ public async Task GetAll_ApiManagementListApiPolicies() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b59475ff190048040001"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiPolicyResource - ApiPolicyCollection collection = api.GetApiPolicies(); + ApiPolicyCollection collection = serviceApi.GetApiPolicies(); // invoke the operation and iterate over the result await foreach (ApiPolicyResource item in collection.GetAllAsync()) @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListApiPolicies() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiPolicy.json // this example is just showing the usage of "ApiPolicy_Get" 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 @@ -69,17 +69,17 @@ public async Task Get_ApiManagementGetApiPolicy() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b59475ff190048040001"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiPolicyResource - ApiPolicyCollection collection = api.GetApiPolicies(); + ApiPolicyCollection collection = serviceApi.GetApiPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -97,7 +97,7 @@ public async Task Get_ApiManagementGetApiPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiPolicy.json // this example is just showing the usage of "ApiPolicy_Get" 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 @@ -105,17 +105,17 @@ public async Task Exists_ApiManagementGetApiPolicy() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b59475ff190048040001"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiPolicyResource - ApiPolicyCollection collection = api.GetApiPolicies(); + ApiPolicyCollection collection = serviceApi.GetApiPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -129,7 +129,7 @@ public async Task Exists_ApiManagementGetApiPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiPolicy.json // this example is just showing the usage of "ApiPolicy_Get" 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 @@ -137,17 +137,17 @@ public async Task GetIfExists_ApiManagementGetApiPolicy() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b59475ff190048040001"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiPolicyResource - ApiPolicyCollection collection = api.GetApiPolicies(); + ApiPolicyCollection collection = serviceApi.GetApiPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -173,7 +173,7 @@ public async Task GetIfExists_ApiManagementGetApiPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -181,17 +181,17 @@ public async Task CreateOrUpdate_ApiManagementCreateApiPolicy() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiPolicyResource - ApiPolicyCollection collection = api.GetApiPolicies(); + ApiPolicyCollection collection = serviceApi.GetApiPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; @@ -216,7 +216,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiPolicyNonXmlEncoded() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiPolicyNonXmlEncoded.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -224,17 +224,17 @@ public async Task CreateOrUpdate_ApiManagementCreateApiPolicyNonXmlEncoded() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiPolicyResource - ApiPolicyCollection collection = api.GetApiPolicies(); + ApiPolicyCollection collection = serviceApi.GetApiPolicies(); // invoke the operation PolicyName policyId = PolicyName.Policy; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyResource.cs index fceeed8ae0fe..5036e91f3bff 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiPolicyResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiPolicyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiPolicy.json // this example is just showing the usage of "ApiPolicy_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadApiPolicy() // this example assumes you already have this ApiPolicyResource created on azure // for more information of creating ApiPolicyResource, please refer to the document of ApiPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadApiPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiPolicy.json // this example is just showing the usage of "ApiPolicy_Get" 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 @@ -62,7 +62,7 @@ public async Task Get_ApiManagementGetApiPolicy() // this example assumes you already have this ApiPolicyResource created on azure // for more information of creating ApiPolicyResource, please refer to the document of ApiPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b59475ff190048040001"; @@ -85,7 +85,7 @@ public async Task Get_ApiManagementGetApiPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateApiPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -95,7 +95,7 @@ public async Task Update_ApiManagementCreateApiPolicy() // this example assumes you already have this ApiPolicyResource created on azure // for more information of creating ApiPolicyResource, please refer to the document of ApiPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b57e7e8880006a040001"; @@ -125,7 +125,7 @@ public async Task Update_ApiManagementCreateApiPolicy() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateApiPolicyNonXmlEncoded() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiPolicyNonXmlEncoded.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -135,7 +135,7 @@ public async Task Update_ApiManagementCreateApiPolicyNonXmlEncoded() // this example assumes you already have this ApiPolicyResource created on azure // for more information of creating ApiPolicyResource, please refer to the document of ApiPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5600b57e7e8880006a040001"; @@ -165,7 +165,7 @@ public async Task Update_ApiManagementCreateApiPolicyNonXmlEncoded() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiPolicy() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiPolicy.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiPolicy.json // this example is just showing the usage of "ApiPolicy_Delete" 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 @@ -175,7 +175,7 @@ public async Task Delete_ApiManagementDeleteApiPolicy() // this example assumes you already have this ApiPolicyResource created on azure // for more information of creating ApiPolicyResource, please refer to the document of ApiPolicyResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "loggerId"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagCollection.cs index 70f1dfdf1db9..95d7d9e674ca 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiTagCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiTags() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiTags.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiTags.json // this example is just showing the usage of "Tag_ListByApi" 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 @@ -30,17 +30,17 @@ public async Task GetAll_ApiManagementListApiTags() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagResource - ApiTagCollection collection = api.GetApiTags(); + ApiTagCollection collection = serviceApi.GetApiTags(); // invoke the operation and iterate over the result await foreach (ApiTagResource item in collection.GetAllAsync()) @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListApiTags() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiTag.json // this example is just showing the usage of "Tag_GetByApi" 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 @@ -68,17 +68,17 @@ public async Task Get_ApiManagementGetApiTag() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagResource - ApiTagCollection collection = api.GetApiTags(); + ApiTagCollection collection = serviceApi.GetApiTags(); // invoke the operation string tagId = "59306a29e4bbd510dc24e5f9"; @@ -96,7 +96,7 @@ public async Task Get_ApiManagementGetApiTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiTag.json // this example is just showing the usage of "Tag_GetByApi" 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 @@ -104,17 +104,17 @@ public async Task Exists_ApiManagementGetApiTag() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagResource - ApiTagCollection collection = api.GetApiTags(); + ApiTagCollection collection = serviceApi.GetApiTags(); // invoke the operation string tagId = "59306a29e4bbd510dc24e5f9"; @@ -128,7 +128,7 @@ public async Task Exists_ApiManagementGetApiTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiTag.json // this example is just showing the usage of "Tag_GetByApi" 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 @@ -136,17 +136,17 @@ public async Task GetIfExists_ApiManagementGetApiTag() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagResource - ApiTagCollection collection = api.GetApiTags(); + ApiTagCollection collection = serviceApi.GetApiTags(); // invoke the operation string tagId = "59306a29e4bbd510dc24e5f9"; @@ -172,7 +172,7 @@ public async Task GetIfExists_ApiManagementGetApiTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -180,17 +180,17 @@ public async Task CreateOrUpdate_ApiManagementCreateApiTag() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagResource - ApiTagCollection collection = api.GetApiTags(); + ApiTagCollection collection = serviceApi.GetApiTags(); // invoke the operation string tagId = "tagId1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionCollection.cs index c9ab5fdf29f0..f1ddb331dc8b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiTagDescriptionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiTagDescriptions() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiTagDescriptions.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiTagDescriptions.json // this example is just showing the usage of "ApiTagDescription_ListByService" 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 @@ -31,17 +31,17 @@ public async Task GetAll_ApiManagementListApiTagDescriptions() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagDescriptionResource - ApiTagDescriptionCollection collection = api.GetApiTagDescriptions(); + ApiTagDescriptionCollection collection = serviceApi.GetApiTagDescriptions(); // invoke the operation and iterate over the result await foreach (ApiTagDescriptionResource item in collection.GetAllAsync()) @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListApiTagDescriptions() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiTagDescription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTagDescription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiTagDescription.json // this example is just showing the usage of "ApiTagDescription_Get" 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 @@ -69,17 +69,17 @@ public async Task Get_ApiManagementGetApiTagDescription() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagDescriptionResource - ApiTagDescriptionCollection collection = api.GetApiTagDescriptions(); + ApiTagDescriptionCollection collection = serviceApi.GetApiTagDescriptions(); // invoke the operation string tagDescriptionId = "59306a29e4bbd510dc24e5f9"; @@ -97,7 +97,7 @@ public async Task Get_ApiManagementGetApiTagDescription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiTagDescription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTagDescription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiTagDescription.json // this example is just showing the usage of "ApiTagDescription_Get" 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 @@ -105,17 +105,17 @@ public async Task Exists_ApiManagementGetApiTagDescription() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagDescriptionResource - ApiTagDescriptionCollection collection = api.GetApiTagDescriptions(); + ApiTagDescriptionCollection collection = serviceApi.GetApiTagDescriptions(); // invoke the operation string tagDescriptionId = "59306a29e4bbd510dc24e5f9"; @@ -129,7 +129,7 @@ public async Task Exists_ApiManagementGetApiTagDescription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiTagDescription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTagDescription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiTagDescription.json // this example is just showing the usage of "ApiTagDescription_Get" 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 @@ -137,17 +137,17 @@ public async Task GetIfExists_ApiManagementGetApiTagDescription() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagDescriptionResource - ApiTagDescriptionCollection collection = api.GetApiTagDescriptions(); + ApiTagDescriptionCollection collection = serviceApi.GetApiTagDescriptions(); // invoke the operation string tagDescriptionId = "59306a29e4bbd510dc24e5f9"; @@ -173,7 +173,7 @@ public async Task GetIfExists_ApiManagementGetApiTagDescription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiTagDescription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiTagDescription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -181,17 +181,17 @@ public async Task CreateOrUpdate_ApiManagementCreateApiTagDescription() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // get the collection of this ApiTagDescriptionResource - ApiTagDescriptionCollection collection = api.GetApiTagDescriptions(); + ApiTagDescriptionCollection collection = serviceApi.GetApiTagDescriptions(); // invoke the operation string tagDescriptionId = "tagId1"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionResource.cs index 253ca929fce6..2d19bf6f5acf 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagDescriptionResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ApiTagDescriptionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiTagDescription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiTagDescription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiTagDescription.json // this example is just showing the usage of "ApiTagDescription_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadApiTagDescription() // this example assumes you already have this ApiTagDescriptionResource created on azure // for more information of creating ApiTagDescriptionResource, please refer to the document of ApiTagDescriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadApiTagDescription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiTagDescription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTagDescription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiTagDescription.json // this example is just showing the usage of "ApiTagDescription_Get" 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 @@ -62,7 +62,7 @@ public async Task Get_ApiManagementGetApiTagDescription() // this example assumes you already have this ApiTagDescriptionResource created on azure // for more information of creating ApiTagDescriptionResource, please refer to the document of ApiTagDescriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; @@ -85,7 +85,7 @@ public async Task Get_ApiManagementGetApiTagDescription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateApiTagDescription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiTagDescription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -95,7 +95,7 @@ public async Task Update_ApiManagementCreateApiTagDescription() // this example assumes you already have this ApiTagDescriptionResource created on azure // for more information of creating ApiTagDescriptionResource, please refer to the document of ApiTagDescriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5931a75ae4bbd512a88c680b"; @@ -125,7 +125,7 @@ public async Task Update_ApiManagementCreateApiTagDescription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiTagDescription() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiTagDescription.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiTagDescription.json // this example is just showing the usage of "ApiTagDescription_Delete" 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 @@ -135,7 +135,7 @@ public async Task Delete_ApiManagementDeleteApiTagDescription() // this example assumes you already have this ApiTagDescriptionResource created on azure // for more information of creating ApiTagDescriptionResource, please refer to the document of ApiTagDescriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d5b28d1f7fab116c282650"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagResource.cs index 6ca526614d17..b03a731c3d90 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiTagResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ApiTagResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityStateByApi_ApiManagementHeadApiTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiTag.json // this example is just showing the usage of "Tag_GetEntityStateByApi" 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 @@ -32,7 +32,7 @@ public async Task GetEntityStateByApi_ApiManagementHeadApiTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; @@ -51,7 +51,7 @@ public async Task GetEntityStateByApi_ApiManagementHeadApiTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiTag.json // this example is just showing the usage of "Tag_GetByApi" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetApiTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; @@ -84,7 +84,7 @@ public async Task Get_ApiManagementGetApiTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateApiTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -94,7 +94,7 @@ public async Task Update_ApiManagementCreateApiTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5931a75ae4bbd512a88c680b"; @@ -118,7 +118,7 @@ public async Task Update_ApiManagementCreateApiTag() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiTag() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiTag.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiTag.json // this example is just showing the usage of "Tag_DetachFromApi" 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 @@ -128,7 +128,7 @@ public async Task Delete_ApiManagementDeleteApiTag() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d5b28d1f7fab116c282650"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationAccessPolicyContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationAccessPolicyContractCollection.cs new file mode 100644 index 000000000000..c5a05f68a45d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationAccessPolicyContractCollection.cs @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_AuthorizationAccessPolicyContractCollection + { + // ApiManagementListAuthorizationAccessPolicies + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListAuthorizationAccessPolicies() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListAuthorizationAccessPolicies.json + // this example is just showing the usage of "AuthorizationAccessPolicy_ListByAuthorization" 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 and iterate over the result + await foreach (AuthorizationAccessPolicyContractResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetAuthorizationAccessPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetAuthorizationAccessPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationAccessPolicy.json + // this example is just showing the usage of "AuthorizationAccessPolicy_Get" 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"; + AuthorizationAccessPolicyContractResource result = await collection.GetAsync(authorizationAccessPolicyId); + + // 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}"); + } + + // ApiManagementGetAuthorizationAccessPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetAuthorizationAccessPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationAccessPolicy.json + // this example is just showing the usage of "AuthorizationAccessPolicy_Get" 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"; + bool result = await collection.ExistsAsync(authorizationAccessPolicyId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetAuthorizationAccessPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetAuthorizationAccessPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationAccessPolicy.json + // this example is just showing the usage of "AuthorizationAccessPolicy_Get" 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"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationAccessPolicyId); + AuthorizationAccessPolicyContractResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateAuthorizationAccessPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateAuthorizationAccessPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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() + { + AppIds = +{ +"d5f04bb0-ba78-4878-a43e-35a0b74fe315" +}, + TenantId = Guid.Parse("13932a0d-5c63-4d37-901d-1df9c97722ff"), + ObjectId = "fe0bed83-631f-4149-bd0b-0464b1bc7cab", + }; + ArmOperation 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationAccessPolicyContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationAccessPolicyContractResource.cs new file mode 100644 index 000000000000..599e9d0495d3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationAccessPolicyContractResource.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_AuthorizationAccessPolicyContractResource + { + // ApiManagementGetAuthorizationAccessPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetAuthorizationAccessPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationAccessPolicy.json + // this example is just showing the usage of "AuthorizationAccessPolicy_Get" 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 AuthorizationAccessPolicyContractResource created on azure + // for more information of creating AuthorizationAccessPolicyContractResource, please refer to the document of AuthorizationAccessPolicyContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string authorizationProviderId = "aadwithauthcode"; + string authorizationId = "authz1"; + string authorizationAccessPolicyId = "fe0bed83-631f-4149-bd0b-0464b1bc7cab"; + ResourceIdentifier authorizationAccessPolicyContractResourceId = AuthorizationAccessPolicyContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId); + AuthorizationAccessPolicyContractResource authorizationAccessPolicyContract = client.GetAuthorizationAccessPolicyContractResource(authorizationAccessPolicyContractResourceId); + + // invoke the operation + AuthorizationAccessPolicyContractResource result = await authorizationAccessPolicyContract.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateAuthorizationAccessPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateAuthorizationAccessPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 AuthorizationAccessPolicyContractResource created on azure + // for more information of creating AuthorizationAccessPolicyContractResource, please refer to the document of AuthorizationAccessPolicyContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string authorizationProviderId = "aadwithauthcode"; + string authorizationId = "authz1"; + string authorizationAccessPolicyId = "fe0bed83-631f-4149-bd0b-0464b1bc7cab"; + ResourceIdentifier authorizationAccessPolicyContractResourceId = AuthorizationAccessPolicyContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId); + AuthorizationAccessPolicyContractResource authorizationAccessPolicyContract = client.GetAuthorizationAccessPolicyContractResource(authorizationAccessPolicyContractResourceId); + + // invoke the operation + AuthorizationAccessPolicyContractData data = new AuthorizationAccessPolicyContractData() + { + AppIds = +{ +"d5f04bb0-ba78-4878-a43e-35a0b74fe315" +}, + TenantId = Guid.Parse("13932a0d-5c63-4d37-901d-1df9c97722ff"), + ObjectId = "fe0bed83-631f-4149-bd0b-0464b1bc7cab", + }; + ArmOperation lro = await authorizationAccessPolicyContract.UpdateAsync(WaitUntil.Completed, 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}"); + } + + // ApiManagementDeleteAuthorizationAccessPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteAuthorizationAccessPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteAuthorizationAccessPolicy.json + // this example is just showing the usage of "AuthorizationAccessPolicy_Delete" 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 AuthorizationAccessPolicyContractResource created on azure + // for more information of creating AuthorizationAccessPolicyContractResource, please refer to the document of AuthorizationAccessPolicyContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string authorizationProviderId = "aadwithauthcode"; + string authorizationId = "authz1"; + string authorizationAccessPolicyId = "fe0bed83-631f-4149-bd0b-0464b1bc7cab"; + ResourceIdentifier authorizationAccessPolicyContractResourceId = AuthorizationAccessPolicyContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId); + AuthorizationAccessPolicyContractResource authorizationAccessPolicyContract = client.GetAuthorizationAccessPolicyContractResource(authorizationAccessPolicyContractResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await authorizationAccessPolicyContract.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationContractCollection.cs new file mode 100644 index 000000000000..43fff2b6dc5e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationContractCollection.cs @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_AuthorizationContractCollection + { + // ApiManagementListAuthorizationsAuthCode + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListAuthorizationsAuthCode() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListAuthorizationsAuthCode.json + // this example is just showing the usage of "Authorization_ListByAuthorizationProvider" 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 and iterate over the result + await foreach (AuthorizationContractResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementListAuthorizationsClientCred + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListAuthorizationsClientCred() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListAuthorizationsClientCred.json + // this example is just showing the usage of "Authorization_ListByAuthorizationProvider" 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 and iterate over the result + await foreach (AuthorizationContractResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetAuthorization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetAuthorization() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorization.json + // this example is just showing the usage of "Authorization_Get" 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 = "authz1"; + AuthorizationContractResource result = await collection.GetAsync(authorizationId); + + // 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}"); + } + + // ApiManagementGetAuthorization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetAuthorization() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorization.json + // this example is just showing the usage of "Authorization_Get" 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 = "authz1"; + bool result = await collection.ExistsAsync(authorizationId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetAuthorization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetAuthorization() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorization.json + // this example is just showing the usage of "Authorization_Get" 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 = "authz1"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationId); + AuthorizationContractResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateAuthorizationAADAuthCode + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateAuthorizationAADAuthCode() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 = AuthorizationType.OAuth2, + OAuth2GrantType = OAuth2GrantType.AuthorizationCode, + }; + ArmOperation 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}"); + } + + // ApiManagementCreateAuthorizationAADClientCred + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateAuthorizationAADClientCred() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 = AuthorizationType.OAuth2, + OAuth2GrantType = OAuth2GrantType.AuthorizationCode, + Parameters = +{ +["clientId"] = "53790925-fdd3-4b80-bc7a-4c3aaf25801d", +["clientSecret"] = "FcJkQ3iPSaKAQRA7Ft8Q~fZ1X5vKmqzUAfJagcJ8", +}, + }; + ArmOperation 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationContractResource.cs new file mode 100644 index 000000000000..a62bd7dab6db --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationContractResource.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_AuthorizationContractResource + { + // ApiManagementGetAuthorization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetAuthorization() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorization.json + // this example is just showing the usage of "Authorization_Get" 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); + + // invoke the operation + AuthorizationContractResource result = await authorizationContract.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateAuthorizationAADAuthCode + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateAuthorizationAADAuthCode() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 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 = "authz2"; + ResourceIdentifier authorizationContractResourceId = AuthorizationContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId); + AuthorizationContractResource authorizationContract = client.GetAuthorizationContractResource(authorizationContractResourceId); + + // invoke the operation + AuthorizationContractData data = new AuthorizationContractData() + { + AuthorizationType = AuthorizationType.OAuth2, + OAuth2GrantType = OAuth2GrantType.AuthorizationCode, + }; + ArmOperation lro = await authorizationContract.UpdateAsync(WaitUntil.Completed, 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}"); + } + + // ApiManagementCreateAuthorizationAADClientCred + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateAuthorizationAADClientCred() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 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 = "aadwithclientcred"; + string authorizationId = "authz1"; + ResourceIdentifier authorizationContractResourceId = AuthorizationContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId); + AuthorizationContractResource authorizationContract = client.GetAuthorizationContractResource(authorizationContractResourceId); + + // invoke the operation + AuthorizationContractData data = new AuthorizationContractData() + { + AuthorizationType = AuthorizationType.OAuth2, + OAuth2GrantType = OAuth2GrantType.AuthorizationCode, + Parameters = +{ +["clientId"] = "53790925-fdd3-4b80-bc7a-4c3aaf25801d", +["clientSecret"] = "FcJkQ3iPSaKAQRA7Ft8Q~fZ1X5vKmqzUAfJagcJ8", +}, + }; + ArmOperation lro = await authorizationContract.UpdateAsync(WaitUntil.Completed, 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}"); + } + + // ApiManagementDeleteAuthorization + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteAuthorization() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteAuthorization.json + // this example is just showing the usage of "Authorization_Delete" 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); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await authorizationContract.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementPostAuthorizationConfirmConsentCodeRequest + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ConfirmConsentCode_ApiManagementPostAuthorizationConfirmConsentCodeRequest() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPostAuthorizationConfirmConsentCodeRequest.json + // this example is just showing the usage of "Authorization_ConfirmConsentCode" 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); + + // invoke the operation + AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract = new AuthorizationConfirmConsentCodeRequestContract() + { + ConsentCode = "theconsentcode", + }; + await authorizationContract.ConfirmConsentCodeAsync(authorizationConfirmConsentCodeRequestContract); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetAuthorizationLoginRequest + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task PostAuthorizationLoginLink_ApiManagementGetAuthorizationLoginRequest() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationLoginRequest.json + // this example is just showing the usage of "AuthorizationLoginLinks_Post" 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); + + // invoke the operation + AuthorizationLoginRequestContract authorizationLoginRequestContract = new AuthorizationLoginRequestContract() + { + PostLoginRedirectUri = new Uri("https://www.bing.com/"), + }; + AuthorizationLoginResponseContract result = await authorizationContract.PostAuthorizationLoginLinkAsync(authorizationLoginRequestContract); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationProviderContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationProviderContractCollection.cs new file mode 100644 index 000000000000..7fd82e76debf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationProviderContractCollection.cs @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_AuthorizationProviderContractCollection + { + // ApiManagementListAuthorizationProviders + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListAuthorizationProviders() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListAuthorizationProviders.json + // this example is just showing the usage of "AuthorizationProvider_ListByService" 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 AuthorizationProviderContractResource + AuthorizationProviderContractCollection collection = apiManagementService.GetAuthorizationProviderContracts(); + + // invoke the operation and iterate over the result + await foreach (AuthorizationProviderContractResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetAuthorizationProvider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetAuthorizationProvider() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationProvider.json + // this example is just showing the usage of "AuthorizationProvider_Get" 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 AuthorizationProviderContractResource + AuthorizationProviderContractCollection collection = apiManagementService.GetAuthorizationProviderContracts(); + + // invoke the operation + string authorizationProviderId = "aadwithauthcode"; + AuthorizationProviderContractResource result = await collection.GetAsync(authorizationProviderId); + + // 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}"); + } + + // ApiManagementGetAuthorizationProvider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetAuthorizationProvider() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationProvider.json + // this example is just showing the usage of "AuthorizationProvider_Get" 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 AuthorizationProviderContractResource + AuthorizationProviderContractCollection collection = apiManagementService.GetAuthorizationProviderContracts(); + + // invoke the operation + string authorizationProviderId = "aadwithauthcode"; + bool result = await collection.ExistsAsync(authorizationProviderId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetAuthorizationProvider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetAuthorizationProvider() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationProvider.json + // this example is just showing the usage of "AuthorizationProvider_Get" 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 AuthorizationProviderContractResource + AuthorizationProviderContractCollection collection = apiManagementService.GetAuthorizationProviderContracts(); + + // invoke the operation + string authorizationProviderId = "aadwithauthcode"; + NullableResponse response = await collection.GetIfExistsAsync(authorizationProviderId); + AuthorizationProviderContractResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateAuthorizationProviderAADAuthCode + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateAuthorizationProviderAADAuthCode() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 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 AuthorizationProviderContractResource + AuthorizationProviderContractCollection collection = apiManagementService.GetAuthorizationProviderContracts(); + + // invoke the operation + string authorizationProviderId = "aadwithauthcode"; + 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"] = "Q3iPSaKQ~fZFcJk5vKmqzUAfJagcJ8", +["resourceUri"] = "https://graph.microsoft.com", +["scopes"] = "User.Read.All Group.Read.All", +}, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationProviderId, 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}"); + } + + // ApiManagementCreateAuthorizationProviderAADClientCred + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateAuthorizationProviderAADClientCred() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 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 AuthorizationProviderContractResource + AuthorizationProviderContractCollection collection = apiManagementService.GetAuthorizationProviderContracts(); + + // invoke the operation + string authorizationProviderId = "aadwithclientcred"; + 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 lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationProviderId, 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}"); + } + + // ApiManagementCreateAuthorizationProviderGenericOAuth2 + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateAuthorizationProviderGenericOAuth2() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 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 AuthorizationProviderContractResource + AuthorizationProviderContractCollection collection = apiManagementService.GetAuthorizationProviderContracts(); + + // invoke the operation + string authorizationProviderId = "eventbrite"; + 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"] = "ZYIJTBTABHOUQQDLZY", +["clientSecret"] = "Q3iPSaKQ~fZFcJk5vKmqzUAfJagcJ8", +["refreshUrl"] = "https://www.eventbrite.com/oauth/token", +["scopes"] = null, +["tokenUrl"] = "https://www.eventbrite.com/oauth/token", +}, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationProviderId, 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}"); + } + + // ApiManagementCreateAuthorizationProviderOOBGoogle + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateAuthorizationProviderOOBGoogle() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 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 AuthorizationProviderContractResource + AuthorizationProviderContractCollection collection = apiManagementService.GetAuthorizationProviderContracts(); + + // invoke the operation + string authorizationProviderId = "google"; + 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"] = "508791967882-5qv6o2i99a75un7329vlegtk78kr766h.apps.googleusercontent.com", +["clientSecret"] = "qDN0VyVFjU1OsOyT5Kz8ce", +["scopes"] = "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email", +}, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationProviderId, 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationProviderContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationProviderContractResource.cs new file mode 100644 index 000000000000..09be75a607a4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_AuthorizationProviderContractResource.cs @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_AuthorizationProviderContractResource + { + // ApiManagementGetAuthorizationProvider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetAuthorizationProvider() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetAuthorizationProvider.json + // this example is just showing the usage of "AuthorizationProvider_Get" 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 + AuthorizationProviderContractResource result = await authorizationProviderContract.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateAuthorizationProviderAADAuthCode + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateAuthorizationProviderAADAuthCode() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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"] = "Q3iPSaKQ~fZFcJk5vKmqzUAfJagcJ8", +["resourceUri"] = "https://graph.microsoft.com", +["scopes"] = "User.Read.All Group.Read.All", +}, + }, + }, + }; + ArmOperation 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}"); + } + + // ApiManagementCreateAuthorizationProviderAADClientCred + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateAuthorizationProviderAADClientCred() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 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}"); + } + + // ApiManagementCreateAuthorizationProviderGenericOAuth2 + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateAuthorizationProviderGenericOAuth2() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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"] = "ZYIJTBTABHOUQQDLZY", +["clientSecret"] = "Q3iPSaKQ~fZFcJk5vKmqzUAfJagcJ8", +["refreshUrl"] = "https://www.eventbrite.com/oauth/token", +["scopes"] = null, +["tokenUrl"] = "https://www.eventbrite.com/oauth/token", +}, + }, + }, + }; + ArmOperation 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}"); + } + + // ApiManagementCreateAuthorizationProviderOOBGoogle + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateAuthorizationProviderOOBGoogle() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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"] = "508791967882-5qv6o2i99a75un7329vlegtk78kr766h.apps.googleusercontent.com", +["clientSecret"] = "qDN0VyVFjU1OsOyT5Kz8ce", +["scopes"] = "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email", +}, + }, + }, + }; + ArmOperation 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}"); + } + + // ApiManagementDeleteAuthorizationProvider + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteAuthorizationProvider() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteAuthorizationProvider.json + // this example is just showing the usage of "AuthorizationProvider_Delete" 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 + ETag ifMatch = new ETag("*"); + await authorizationProviderContract.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_DocumentationContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_DocumentationContractCollection.cs new file mode 100644 index 000000000000..92f4c05c11d0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_DocumentationContractCollection.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_DocumentationContractCollection + { + // ApiManagementListApis + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListApis() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListDocumentations.json + // this example is just showing the usage of "Documentation_ListByService" 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 DocumentationContractResource + DocumentationContractCollection collection = apiManagementService.GetDocumentationContracts(); + + // invoke the operation and iterate over the result + await foreach (DocumentationContractResource item in collection.GetAllAsync()) + { + // the variable item 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 + DocumentationContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetDocumentation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetDocumentation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDocumentation.json + // this example is just showing the usage of "Documentation_Get" 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 DocumentationContractResource + DocumentationContractCollection collection = apiManagementService.GetDocumentationContracts(); + + // invoke the operation + string documentationId = "57d1f7558aa04f15146d9d8a"; + DocumentationContractResource result = await collection.GetAsync(documentationId); + + // 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 + DocumentationContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetDocumentation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetDocumentation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDocumentation.json + // this example is just showing the usage of "Documentation_Get" 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 DocumentationContractResource + DocumentationContractCollection collection = apiManagementService.GetDocumentationContracts(); + + // invoke the operation + string documentationId = "57d1f7558aa04f15146d9d8a"; + bool result = await collection.ExistsAsync(documentationId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetDocumentation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetDocumentation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDocumentation.json + // this example is just showing the usage of "Documentation_Get" 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 DocumentationContractResource + DocumentationContractCollection collection = apiManagementService.GetDocumentationContracts(); + + // invoke the operation + string documentationId = "57d1f7558aa04f15146d9d8a"; + NullableResponse response = await collection.GetIfExistsAsync(documentationId); + DocumentationContractResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + DocumentationContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateDocumentation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateDocumentation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateDocumentation.json + // this example is just showing the usage of "Documentation_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 DocumentationContractResource + DocumentationContractCollection collection = apiManagementService.GetDocumentationContracts(); + + // invoke the operation + string documentationId = "57d1f7558aa04f15146d9d8a"; + DocumentationContractData data = new DocumentationContractData() + { + Title = "Title", + Content = "content", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, documentationId, data); + DocumentationContractResource 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 + DocumentationContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_DocumentationContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_DocumentationContractResource.cs new file mode 100644 index 000000000000..6113849de8f9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_DocumentationContractResource.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_DocumentationContractResource + { + // ApiManagementHeadDocumentation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadDocumentation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadDocumentation.json + // this example is just showing the usage of "Documentation_GetEntityTag" 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 DocumentationContractResource created on azure + // for more information of creating DocumentationContractResource, please refer to the document of DocumentationContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string documentationId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier documentationContractResourceId = DocumentationContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, documentationId); + DocumentationContractResource documentationContract = client.GetDocumentationContractResource(documentationContractResourceId); + + // invoke the operation + bool result = await documentationContract.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetDocumentation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetDocumentation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetDocumentation.json + // this example is just showing the usage of "Documentation_Get" 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 DocumentationContractResource created on azure + // for more information of creating DocumentationContractResource, please refer to the document of DocumentationContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string documentationId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier documentationContractResourceId = DocumentationContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, documentationId); + DocumentationContractResource documentationContract = client.GetDocumentationContractResource(documentationContractResourceId); + + // invoke the operation + DocumentationContractResource result = await documentationContract.GetAsync(); + + // 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 + DocumentationContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementUpdateDocumentation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateDocumentation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateDocumentation.json + // this example is just showing the usage of "Documentation_Update" 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 DocumentationContractResource created on azure + // for more information of creating DocumentationContractResource, please refer to the document of DocumentationContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string documentationId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier documentationContractResourceId = DocumentationContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, documentationId); + DocumentationContractResource documentationContract = client.GetDocumentationContractResource(documentationContractResourceId); + + // invoke the operation + ETag ifMatch = default /* Warning: No value is provided for ifMatch in example 'ApiManagementUpdateDocumentation'. Please consider adding a proper example value for it in swagger*/; + DocumentationContractPatch patch = new DocumentationContractPatch() + { + Title = "Title updated", + Content = "content updated", + }; + DocumentationContractResource result = await documentationContract.UpdateAsync(ifMatch, patch); + + // 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 + DocumentationContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteDocumentation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteDocumentation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteDocumentation.json + // this example is just showing the usage of "Documentation_Delete" 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 DocumentationContractResource created on azure + // for more information of creating DocumentationContractResource, please refer to the document of DocumentationContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string documentationId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier documentationContractResourceId = DocumentationContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, documentationId); + DocumentationContractResource documentationContract = client.GetDocumentationContractResource(documentationContractResourceId); + + // invoke the operation + ETag ifMatch = default /* Warning: No value is provided for ifMatch in example 'ApiManagementDeleteDocumentation'. Please consider adding a proper example value for it in swagger*/; + await documentationContract.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PolicyRestrictionContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PolicyRestrictionContractCollection.cs new file mode 100644 index 000000000000..fc2c16b52536 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PolicyRestrictionContractCollection.cs @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_PolicyRestrictionContractCollection + { + // ApiManagementListPolicyRestrictions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListPolicyRestrictions() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPolicyRestrictions.json + // this example is just showing the usage of "PolicyRestriction_ListByService" 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 PolicyRestrictionContractResource + PolicyRestrictionContractCollection collection = apiManagementService.GetPolicyRestrictionContracts(); + + // invoke the operation and iterate over the result + await foreach (PolicyRestrictionContractResource item in collection.GetAllAsync()) + { + // the variable item 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 + PolicyRestrictionContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetPolicyRestriction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetPolicyRestriction() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyRestriction.json + // this example is just showing the usage of "PolicyRestriction_Get" 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 PolicyRestrictionContractResource + PolicyRestrictionContractCollection collection = apiManagementService.GetPolicyRestrictionContracts(); + + // invoke the operation + string policyRestrictionId = "policyRestriction1"; + PolicyRestrictionContractResource result = await collection.GetAsync(policyRestrictionId); + + // 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 + PolicyRestrictionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetPolicyRestriction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetPolicyRestriction() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyRestriction.json + // this example is just showing the usage of "PolicyRestriction_Get" 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 PolicyRestrictionContractResource + PolicyRestrictionContractCollection collection = apiManagementService.GetPolicyRestrictionContracts(); + + // invoke the operation + string policyRestrictionId = "policyRestriction1"; + bool result = await collection.ExistsAsync(policyRestrictionId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetPolicyRestriction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetPolicyRestriction() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyRestriction.json + // this example is just showing the usage of "PolicyRestriction_Get" 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 PolicyRestrictionContractResource + PolicyRestrictionContractCollection collection = apiManagementService.GetPolicyRestrictionContracts(); + + // invoke the operation + string policyRestrictionId = "policyRestriction1"; + NullableResponse response = await collection.GetIfExistsAsync(policyRestrictionId); + PolicyRestrictionContractResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + PolicyRestrictionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreatePolicyRestriction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreatePolicyRestriction() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreatePolicyRestriction.json + // this example is just showing the usage of "PolicyRestriction_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 PolicyRestrictionContractResource + PolicyRestrictionContractCollection collection = apiManagementService.GetPolicyRestrictionContracts(); + + // invoke the operation + string policyRestrictionId = "policyRestriction1"; + PolicyRestrictionContractData data = new PolicyRestrictionContractData() + { + Scope = "Sample Path to the policy document.", + RequireBase = PolicyRestrictionRequireBase.True, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyRestrictionId, data, ifMatch: ifMatch); + PolicyRestrictionContractResource 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 + PolicyRestrictionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PolicyRestrictionContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PolicyRestrictionContractResource.cs new file mode 100644 index 000000000000..3807906bab08 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PolicyRestrictionContractResource.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_PolicyRestrictionContractResource + { + // ApiManagementHeadPolicyRestriction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadPolicyRestriction() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadPolicyRestriction.json + // this example is just showing the usage of "PolicyRestriction_GetEntityTag" 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 PolicyRestrictionContractResource created on azure + // for more information of creating PolicyRestrictionContractResource, please refer to the document of PolicyRestrictionContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string policyRestrictionId = "policyRestriction1"; + ResourceIdentifier policyRestrictionContractResourceId = PolicyRestrictionContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, policyRestrictionId); + PolicyRestrictionContractResource policyRestrictionContract = client.GetPolicyRestrictionContractResource(policyRestrictionContractResourceId); + + // invoke the operation + bool result = await policyRestrictionContract.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetPolicyRestriction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetPolicyRestriction() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyRestriction.json + // this example is just showing the usage of "PolicyRestriction_Get" 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 PolicyRestrictionContractResource created on azure + // for more information of creating PolicyRestrictionContractResource, please refer to the document of PolicyRestrictionContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string policyRestrictionId = "policyRestriction1"; + ResourceIdentifier policyRestrictionContractResourceId = PolicyRestrictionContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, policyRestrictionId); + PolicyRestrictionContractResource policyRestrictionContract = client.GetPolicyRestrictionContractResource(policyRestrictionContractResourceId); + + // invoke the operation + PolicyRestrictionContractResource result = await policyRestrictionContract.GetAsync(); + + // 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 + PolicyRestrictionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementUpdatePolicyRestriction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdatePolicyRestriction() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdatePolicyRestriction.json + // this example is just showing the usage of "PolicyRestriction_Update" 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 PolicyRestrictionContractResource created on azure + // for more information of creating PolicyRestrictionContractResource, please refer to the document of PolicyRestrictionContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string policyRestrictionId = "policyRestriction1"; + ResourceIdentifier policyRestrictionContractResourceId = PolicyRestrictionContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, policyRestrictionId); + PolicyRestrictionContractResource policyRestrictionContract = client.GetPolicyRestrictionContractResource(policyRestrictionContractResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + PolicyRestrictionContractPatch patch = new PolicyRestrictionContractPatch() + { + Scope = "Sample Path 2 to the policy document.", + }; + PolicyRestrictionContractResource result = await policyRestrictionContract.UpdateAsync(ifMatch, patch); + + // 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 + PolicyRestrictionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeletePolicyRestriction + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeletePolicyRestriction() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeletePolicyRestriction.json + // this example is just showing the usage of "PolicyRestriction_Delete" 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 PolicyRestrictionContractResource created on azure + // for more information of creating PolicyRestrictionContractResource, please refer to the document of PolicyRestrictionContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string policyRestrictionId = "policyRestriction1"; + ResourceIdentifier policyRestrictionContractResourceId = PolicyRestrictionContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, policyRestrictionId); + PolicyRestrictionContractResource policyRestrictionContract = client.GetPolicyRestrictionContractResource(policyRestrictionContractResourceId); + + // invoke the operation + ETag? ifMatch = new ETag("*"); + await policyRestrictionContract.DeleteAsync(WaitUntil.Completed, ifMatch: ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PortalConfigContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PortalConfigContractCollection.cs new file mode 100644 index 000000000000..f8b419c4779f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PortalConfigContractCollection.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_PortalConfigContractCollection + { + // ApiManagementListPortalConfig + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListPortalConfig() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPortalConfig.json + // this example is just showing the usage of "PortalConfig_ListByService" 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 PortalConfigContractResource + PortalConfigContractCollection collection = apiManagementService.GetPortalConfigContracts(); + + // invoke the operation and iterate over the result + await foreach (PortalConfigContractResource item in collection.GetAllAsync()) + { + // the variable item 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 + PortalConfigContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementPortalConfig + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementPortalConfig() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalConfig.json + // this example is just showing the usage of "PortalConfig_Get" 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 PortalConfigContractResource + PortalConfigContractCollection collection = apiManagementService.GetPortalConfigContracts(); + + // invoke the operation + string portalConfigId = "default"; + PortalConfigContractResource result = await collection.GetAsync(portalConfigId); + + // 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 + PortalConfigContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementPortalConfig + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementPortalConfig() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalConfig.json + // this example is just showing the usage of "PortalConfig_Get" 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 PortalConfigContractResource + PortalConfigContractCollection collection = apiManagementService.GetPortalConfigContracts(); + + // invoke the operation + string portalConfigId = "default"; + bool result = await collection.ExistsAsync(portalConfigId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementPortalConfig + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementPortalConfig() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalConfig.json + // this example is just showing the usage of "PortalConfig_Get" 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 PortalConfigContractResource + PortalConfigContractCollection collection = apiManagementService.GetPortalConfigContracts(); + + // invoke the operation + string portalConfigId = "default"; + NullableResponse response = await collection.GetIfExistsAsync(portalConfigId); + PortalConfigContractResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + PortalConfigContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreatePortalConfig + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreatePortalConfig() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreatePortalConfig.json + // this example is just showing the usage of "PortalConfig_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 PortalConfigContractResource + PortalConfigContractCollection collection = apiManagementService.GetPortalConfigContracts(); + + // invoke the operation + string portalConfigId = "default"; + ETag ifMatch = new ETag("*"); + PortalConfigContractData data = new PortalConfigContractData() + { + EnableBasicAuth = true, + Require = false, + SignupTermsOfService = new PortalConfigTermsOfServiceProperties() + { + Text = "I agree to the service terms and conditions.", + RequireConsent = false, + }, + Delegation = new PortalConfigDelegationProperties() + { + DelegateRegistration = false, + DelegateSubscription = false, + DelegationUri = null, + ValidationKey = null, + }, + CorsAllowedOrigins = +{ +"https://contoso.com" +}, + Csp = new PortalConfigCspProperties() + { + Mode = PortalSettingsCspMode.ReportOnly, + ReportUri = +{ +new Uri("https://report.contoso.com") +}, + AllowedSources = +{ +"*.contoso.com" +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, portalConfigId, ifMatch, data); + PortalConfigContractResource 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 + PortalConfigContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PortalConfigContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PortalConfigContractResource.cs new file mode 100644 index 000000000000..791a70e24cfc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_PortalConfigContractResource.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_PortalConfigContractResource + { + // ApiManagementHeadPortalConfig + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadPortalConfig() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadPortalConfig.json + // this example is just showing the usage of "PortalConfig_GetEntityTag" 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 PortalConfigContractResource created on azure + // for more information of creating PortalConfigContractResource, please refer to the document of PortalConfigContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string portalConfigId = "default"; + ResourceIdentifier portalConfigContractResourceId = PortalConfigContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, portalConfigId); + PortalConfigContractResource portalConfigContract = client.GetPortalConfigContractResource(portalConfigContractResourceId); + + // invoke the operation + bool result = await portalConfigContract.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementPortalConfig + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementPortalConfig() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementPortalConfig.json + // this example is just showing the usage of "PortalConfig_Get" 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 PortalConfigContractResource created on azure + // for more information of creating PortalConfigContractResource, please refer to the document of PortalConfigContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string portalConfigId = "default"; + ResourceIdentifier portalConfigContractResourceId = PortalConfigContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, portalConfigId); + PortalConfigContractResource portalConfigContract = client.GetPortalConfigContractResource(portalConfigContractResourceId); + + // invoke the operation + PortalConfigContractResource result = await portalConfigContract.GetAsync(); + + // 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 + PortalConfigContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementUpdatePortalConfig + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdatePortalConfig() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdatePortalConfig.json + // this example is just showing the usage of "PortalConfig_Update" 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 PortalConfigContractResource created on azure + // for more information of creating PortalConfigContractResource, please refer to the document of PortalConfigContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string portalConfigId = "default"; + ResourceIdentifier portalConfigContractResourceId = PortalConfigContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, portalConfigId); + PortalConfigContractResource portalConfigContract = client.GetPortalConfigContractResource(portalConfigContractResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + PortalConfigContractData data = new PortalConfigContractData() + { + EnableBasicAuth = true, + Require = false, + SignupTermsOfService = new PortalConfigTermsOfServiceProperties() + { + Text = "I agree to the service terms and conditions.", + RequireConsent = false, + }, + Delegation = new PortalConfigDelegationProperties() + { + DelegateRegistration = false, + DelegateSubscription = false, + DelegationUri = null, + ValidationKey = null, + }, + CorsAllowedOrigins = +{ +"https://contoso.com" +}, + Csp = new PortalConfigCspProperties() + { + Mode = PortalSettingsCspMode.ReportOnly, + ReportUri = +{ +new Uri("https://report.contoso.com") +}, + AllowedSources = +{ +"*.contoso.com" +}, + }, + }; + PortalConfigContractResource result = await portalConfigContract.UpdateAsync(ifMatch, data); + + // 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 + PortalConfigContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ResolverContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ResolverContractCollection.cs new file mode 100644 index 000000000000..340eeb8309a2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ResolverContractCollection.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ResolverContractCollection + { + // ApiManagementListGraphQLApiResolvers + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListGraphQLApiResolvers() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListGraphQLApiResolvers.json + // this example is just showing the usage of "GraphQLApiResolver_ListByApi" 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 ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); + + // get the collection of this ResolverContractResource + ResolverContractCollection collection = serviceApi.GetResolverContracts(); + + // invoke the operation and iterate over the result + await foreach (ResolverContractResource item in collection.GetAllAsync()) + { + // the variable item 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 + ResolverContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetGraphQLApiResolver + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetGraphQLApiResolver() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGraphQLApiResolver.json + // this example is just showing the usage of "GraphQLApiResolver_Get" 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 ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); + + // get the collection of this ResolverContractResource + ResolverContractCollection collection = serviceApi.GetResolverContracts(); + + // invoke the operation + string resolverId = "57d2ef278aa04f0ad01d6cdc"; + ResolverContractResource result = await collection.GetAsync(resolverId); + + // 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 + ResolverContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetGraphQLApiResolver + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetGraphQLApiResolver() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGraphQLApiResolver.json + // this example is just showing the usage of "GraphQLApiResolver_Get" 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 ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); + + // get the collection of this ResolverContractResource + ResolverContractCollection collection = serviceApi.GetResolverContracts(); + + // invoke the operation + string resolverId = "57d2ef278aa04f0ad01d6cdc"; + bool result = await collection.ExistsAsync(resolverId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetGraphQLApiResolver + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetGraphQLApiResolver() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGraphQLApiResolver.json + // this example is just showing the usage of "GraphQLApiResolver_Get" 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 ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); + + // get the collection of this ResolverContractResource + ResolverContractCollection collection = serviceApi.GetResolverContracts(); + + // invoke the operation + string resolverId = "57d2ef278aa04f0ad01d6cdc"; + NullableResponse response = await collection.GetIfExistsAsync(resolverId); + ResolverContractResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ResolverContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateGraphQLApiResolver + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateGraphQLApiResolver() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGraphQLApiResolver.json + // this example is just showing the usage of "GraphQLApiResolver_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 ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "someAPI"; + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); + + // get the collection of this ResolverContractResource + ResolverContractCollection collection = serviceApi.GetResolverContracts(); + + // invoke the operation + string resolverId = "newResolver"; + ResolverContractData data = new ResolverContractData() + { + DisplayName = "Query Users", + Path = "Query/users", + Description = "A GraphQL Resolver example", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resolverId, data); + ResolverContractResource 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 + ResolverContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ResolverContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ResolverContractResource.cs new file mode 100644 index 000000000000..63ac5069c43f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ResolverContractResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ResolverContractResource + { + // ApiManagementHeadGraphQLApiResolver + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadGraphQLApiResolver() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadGraphQLApiResolver.json + // this example is just showing the usage of "GraphQLApiResolver_GetEntityTag" 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 ResolverContractResource created on azure + // for more information of creating ResolverContractResource, please refer to the document of ResolverContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + string resolverId = "57d2ef278aa04f0ad01d6cdc"; + ResourceIdentifier resolverContractResourceId = ResolverContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + ResolverContractResource resolverContract = client.GetResolverContractResource(resolverContractResourceId); + + // invoke the operation + bool result = await resolverContract.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetGraphQLApiResolver + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetGraphQLApiResolver() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGraphQLApiResolver.json + // this example is just showing the usage of "GraphQLApiResolver_Get" 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 ResolverContractResource created on azure + // for more information of creating ResolverContractResource, please refer to the document of ResolverContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + string resolverId = "57d2ef278aa04f0ad01d6cdc"; + ResourceIdentifier resolverContractResourceId = ResolverContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + ResolverContractResource resolverContract = client.GetResolverContractResource(resolverContractResourceId); + + // invoke the operation + ResolverContractResource result = await resolverContract.GetAsync(); + + // 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 + ResolverContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementUpdateGraphQLApiResolver + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateGraphQLApiResolver() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateGraphQLApiResolver.json + // this example is just showing the usage of "GraphQLApiResolver_Update" 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 ResolverContractResource created on azure + // for more information of creating ResolverContractResource, please refer to the document of ResolverContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "echo-api"; + string resolverId = "resolverId"; + ResourceIdentifier resolverContractResourceId = ResolverContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + ResolverContractResource resolverContract = client.GetResolverContractResource(resolverContractResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + ResolverContractPatch patch = new ResolverContractPatch() + { + DisplayName = "Query AdminUsers", + Path = "Query/adminUsers", + Description = "A GraphQL Resolver example", + }; + ResolverContractResource result = await resolverContract.UpdateAsync(ifMatch, patch); + + // 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 + ResolverContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteGraphQLApiResolver + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteGraphQLApiResolver() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteGraphQLApiResolver.json + // this example is just showing the usage of "GraphQLApiResolver_Delete" 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 ResolverContractResource created on azure + // for more information of creating ResolverContractResource, please refer to the document of ResolverContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + string resolverId = "57d2ef278aa04f0ad01d6cdc"; + ResourceIdentifier resolverContractResourceId = ResolverContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + ResolverContractResource resolverContract = client.GetResolverContractResource(resolverContractResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await resolverContract.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiCollection.cs similarity index 61% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiCollection.cs index 17cd08900859..a8ec0733b98c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiCollection.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiCollection + public partial class Sample_ServiceApiCollection { // ApiManagementListApis [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApis() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApis.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApis.json // this example is just showing the usage of "Api_ListByService" 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 @@ -33,17 +33,17 @@ public async Task GetAll_ApiManagementListApis() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation and iterate over the result - await foreach (ApiResource item in collection.GetAllAsync()) + await foreach (ServiceApiResource item in collection.GetAllAsync()) { // the variable item 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 @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListApis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiContract() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiContract.json // this example is just showing the usage of "Api_Get" 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 @@ -70,18 +70,18 @@ public async Task Get_ApiManagementGetApiContract() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "57d1f7558aa04f15146d9d8a"; - ApiResource result = await collection.GetAsync(apiId); + ServiceApiResource result = await collection.GetAsync(apiId); // 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 @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetApiContract() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiContract() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiContract.json // this example is just showing the usage of "Api_Get" 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 @@ -105,14 +105,14 @@ public async Task Exists_ApiManagementGetApiContract() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "57d1f7558aa04f15146d9d8a"; @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetApiContract() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiContract() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiContract.json // this example is just showing the usage of "Api_Get" 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 @@ -136,19 +136,19 @@ public async Task GetIfExists_ApiManagementGetApiContract() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "57d1f7558aa04f15146d9d8a"; - NullableResponse response = await collection.GetIfExistsAsync(apiId); - ApiResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(apiId); + ServiceApiResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetApiContract() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiRevisionContract() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiRevision.json // this example is just showing the usage of "Api_Get" 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 @@ -179,18 +179,18 @@ public async Task Get_ApiManagementGetApiRevisionContract() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "echo-api;rev=3"; - ApiResource result = await collection.GetAsync(apiId); + ServiceApiResource result = await collection.GetAsync(apiId); // 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 @@ -204,7 +204,7 @@ public async Task Get_ApiManagementGetApiRevisionContract() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiRevisionContract() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiRevision.json // this example is just showing the usage of "Api_Get" 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 @@ -214,14 +214,14 @@ public async Task Exists_ApiManagementGetApiRevisionContract() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "echo-api;rev=3"; @@ -235,7 +235,7 @@ public async Task Exists_ApiManagementGetApiRevisionContract() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiRevisionContract() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiRevision.json // this example is just showing the usage of "Api_Get" 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 @@ -245,19 +245,19 @@ public async Task GetIfExists_ApiManagementGetApiRevisionContract() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "echo-api;rev=3"; - NullableResponse response = await collection.GetIfExistsAsync(apiId); - ApiResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(apiId); + ServiceApiResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -278,7 +278,7 @@ public async Task GetIfExists_ApiManagementGetApiRevisionContract() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -288,18 +288,18 @@ public async Task CreateOrUpdate_ApiManagementCreateApi() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "tempgroup"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Description = "apidescription5200", AuthenticationSettings = new AuthenticationSettingsContract() @@ -323,8 +323,8 @@ public async Task CreateOrUpdate_ApiManagementCreateApi() ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -338,7 +338,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiClone() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiClone.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -348,23 +348,23 @@ public async Task CreateOrUpdate_ApiManagementCreateApiClone() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "echo-api2"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Description = "Copy of Existing Echo Api including Operations.", IsCurrent = true, IsSubscriptionRequired = true, - SourceApiId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001"), + SourceApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001"), DisplayName = "Echo API2", ServiceUri = new Uri("http://echoapi.cloudapp.net/api"), Path = "echo2", @@ -373,8 +373,8 @@ public async Task CreateOrUpdate_ApiManagementCreateApiClone() ApiOperationInvokableProtocol.Http,ApiOperationInvokableProtocol.Https }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -388,7 +388,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiClone() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiNewVersionUsingExistingApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -398,25 +398,25 @@ public async Task CreateOrUpdate_ApiManagementCreateApiNewVersionUsingExistingAp // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "echoapiv3"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Description = "Create Echo API into a new Version using Existing Version Set and Copy all Operations.", ApiVersion = "v4", IsCurrent = true, - ApiVersionSetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"), + 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/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath"), + SourceApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath"), DisplayName = "Echo API2", ServiceUri = new Uri("http://echoapi.cloudapp.net/api"), Path = "echo2", @@ -425,8 +425,8 @@ public async Task CreateOrUpdate_ApiManagementCreateApiNewVersionUsingExistingAp ApiOperationInvokableProtocol.Http,ApiOperationInvokableProtocol.Https }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -440,7 +440,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiNewVersionUsingExistingAp [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiRevisionFromExistingApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -450,26 +450,26 @@ public async Task CreateOrUpdate_ApiManagementCreateApiRevisionFromExistingApi() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "echo-api;rev=3"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { ApiRevisionDescription = "Creating a Revision of an existing API", - SourceApiId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"), + SourceApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"), ServiceUri = new Uri("http://echoapi.cloudapp.net/apiv3"), Path = "echo", }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -483,7 +483,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiRevisionFromExistingApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiUsingImportOverrideServiceUrl() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -493,26 +493,26 @@ public async Task CreateOrUpdate_ApiManagementCreateApiUsingImportOverrideServic // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "apidocs"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { ServiceUri = new Uri("http://petstore.swagger.wordnik.com/api"), Path = "petstoreapi123", Value = "http://apimpimportviaurl.azurewebsites.net/api/apidocs/", Format = new ContentFormat("swagger-link"), }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -526,7 +526,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiUsingImportOverrideServic [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiUsingOai3Import() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingOai3Import.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -536,25 +536,68 @@ public async Task CreateOrUpdate_ApiManagementCreateApiUsingOai3Import() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "petstore"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Path = "petstore", Value = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml", Format = ContentFormat.OpenApiLink, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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}"); + } + + // ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); + + // invoke the operation + string apiId = "petstore"; + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() + { + Path = "petstore", + Value = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml", + Format = ContentFormat.OpenApiLink, + TranslateRequiredQueryParametersConduct = TranslateRequiredQueryParametersConduct.Template, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -568,7 +611,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiUsingOai3Import() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiUsingSwaggerImport() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingSwaggerImport.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -578,25 +621,25 @@ public async Task CreateOrUpdate_ApiManagementCreateApiUsingSwaggerImport() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "petstore"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Path = "petstore", Value = "http://petstore.swagger.io/v2/swagger.json", Format = ContentFormat.SwaggerLinkJson, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -610,7 +653,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiUsingSwaggerImport() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiUsingWadlImport() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiUsingWadlImport.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -620,25 +663,165 @@ public async Task CreateOrUpdate_ApiManagementCreateApiUsingWadlImport() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "petstore"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Path = "collector", Value = "https://developer.cisco.com/media/wae-release-6-2-api-reference/wae-collector-rest-api/application.wadl", Format = ContentFormat.WadlLinkJson, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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}"); + } + + // ApiManagementCreateApiWithMultipleAuthServers + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateApiWithMultipleAuthServers() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); + + // invoke the operation + string apiId = "tempgroup"; + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() + { + 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", + ServiceUri = new Uri("http://newechoapi.cloudapp.net/api"), + Path = "newapiPath", + Protocols = +{ +ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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}"); + } + + // ApiManagementCreateApiWithMultipleOpenIdConnectProviders + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateApiWithMultipleOpenIdConnectProviders() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); + + // invoke the operation + string apiId = "tempgroup"; + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() + { + 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", + ServiceUri = new Uri("http://newechoapi.cloudapp.net/api"), + Path = "newapiPath", + Protocols = +{ +ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -652,7 +835,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiUsingWadlImport() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiWithOpenIdConnect() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiWithOpenIdConnect.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -662,18 +845,18 @@ public async Task CreateOrUpdate_ApiManagementCreateApiWithOpenIdConnect() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "tempgroup"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { 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() @@ -700,8 +883,8 @@ public async Task CreateOrUpdate_ApiManagementCreateApiWithOpenIdConnect() ApiOperationInvokableProtocol.Https }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -715,7 +898,7 @@ public async Task CreateOrUpdate_ApiManagementCreateApiWithOpenIdConnect() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateGraphQLApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGraphQLApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGraphQLApi.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 @@ -725,18 +908,18 @@ public async Task CreateOrUpdate_ApiManagementCreateGraphQLApi() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "tempgroup"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Description = "apidescription5200", ApiType = ApiType.GraphQL, @@ -748,8 +931,108 @@ public async Task CreateOrUpdate_ApiManagementCreateGraphQLApi() ApiOperationInvokableProtocol.Http,ApiOperationInvokableProtocol.Https }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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}"); + } + + // ApiManagementCreateGrpcApi + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateGrpcApi() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGrpcApi.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 ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); + + // invoke the operation + string apiId = "tempgroup"; + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() + { + Description = "apidescription5200", + ApiType = ApiType.Grpc, + DisplayName = "apiname1463", + ServiceUri = new Uri("https://your-api-hostname/samples"), + Path = "grpc-api", + Protocols = +{ +ApiOperationInvokableProtocol.Https +}, + Value = "https://raw.githubusercontent.com/kedacore/keda/main/pkg/scalers/externalscaler/externalscaler.proto", + Format = ContentFormat.GrpcLink, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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}"); + } + + // ApiManagementCreateODataApi + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateODataApi() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateODataApi.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 ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); + + // invoke the operation + string apiId = "tempgroup"; + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() + { + Description = "apidescription5200", + ApiType = ApiType.Odata, + DisplayName = "apiname1463", + ServiceUri = new Uri("https://services.odata.org/TripPinWebApiService"), + Path = "odata-api", + Protocols = +{ +ApiOperationInvokableProtocol.Http,ApiOperationInvokableProtocol.Https +}, + Value = "https://services.odata.org/TripPinWebApiService/$metadata", + Format = ContentFormat.OdataLink, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -763,7 +1046,7 @@ public async Task CreateOrUpdate_ApiManagementCreateGraphQLApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateSoapPassThroughApiUsingWsdlImport() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.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 @@ -773,18 +1056,18 @@ public async Task CreateOrUpdate_ApiManagementCreateSoapPassThroughApiUsingWsdlI // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "soapApi"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Path = "currency", Value = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL", @@ -796,8 +1079,8 @@ public async Task CreateOrUpdate_ApiManagementCreateSoapPassThroughApiUsingWsdlI }, SoapApiType = SoapApiType.SoapPassThrough, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -811,7 +1094,7 @@ public async Task CreateOrUpdate_ApiManagementCreateSoapPassThroughApiUsingWsdlI [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateSoapToRestApiUsingWsdlImport() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.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 @@ -821,18 +1104,18 @@ public async Task CreateOrUpdate_ApiManagementCreateSoapToRestApiUsingWsdlImport // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "soapApi"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Path = "currency", Value = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL", @@ -843,8 +1126,8 @@ public async Task CreateOrUpdate_ApiManagementCreateSoapToRestApiUsingWsdlImport WsdlEndpointName = "CurrencyConvertorSoap", }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 @@ -858,7 +1141,7 @@ public async Task CreateOrUpdate_ApiManagementCreateSoapToRestApiUsingWsdlImport [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateWebSocketApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateWebsocketApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWebsocketApi.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 @@ -868,18 +1151,18 @@ public async Task CreateOrUpdate_ApiManagementCreateWebSocketApi() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiResource + ServiceApiCollection collection = apiManagementService.GetServiceApis(); // invoke the operation string apiId = "tempgroup"; - ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent() + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() { Description = "apidescription5200", ApiType = ApiType.WebSocket, @@ -891,8 +1174,8 @@ public async Task CreateOrUpdate_ApiManagementCreateWebSocketApi() ApiOperationInvokableProtocol.Wss,ApiOperationInvokableProtocol.Ws }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content); - ApiResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceApiResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiOperationCollection.cs similarity index 62% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiOperationCollection.cs index 00e03b31dfab..d694f0b61a00 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiOperationCollection.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiOperationCollection + public partial class Sample_ServiceApiOperationCollection { // ApiManagementListApiOperations [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiOperations() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperations.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiOperations.json // this example is just showing the usage of "ApiOperation_ListByApi" 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 @@ -31,20 +31,20 @@ public async Task GetAll_ApiManagementListApiOperations() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiOperationResource - ApiOperationCollection collection = api.GetApiOperations(); + // get the collection of this ServiceApiOperationResource + ServiceApiOperationCollection collection = serviceApi.GetServiceApiOperations(); // invoke the operation and iterate over the result - await foreach (ApiOperationResource item in collection.GetAllAsync()) + await foreach (ServiceApiOperationResource item in collection.GetAllAsync()) { // the variable item 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 @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListApiOperations() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiOperation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperation.json // this example is just showing the usage of "ApiOperation_Get" 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 @@ -69,21 +69,21 @@ public async Task Get_ApiManagementGetApiOperation() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiOperationResource - ApiOperationCollection collection = api.GetApiOperations(); + // get the collection of this ServiceApiOperationResource + ServiceApiOperationCollection collection = serviceApi.GetServiceApiOperations(); // invoke the operation string operationId = "57d2ef278aa04f0ad01d6cdc"; - ApiOperationResource result = await collection.GetAsync(operationId); + ServiceApiOperationResource result = await collection.GetAsync(operationId); // 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 @@ -97,7 +97,7 @@ public async Task Get_ApiManagementGetApiOperation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiOperation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperation.json // this example is just showing the usage of "ApiOperation_Get" 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 @@ -105,17 +105,17 @@ public async Task Exists_ApiManagementGetApiOperation() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiOperationResource - ApiOperationCollection collection = api.GetApiOperations(); + // get the collection of this ServiceApiOperationResource + ServiceApiOperationCollection collection = serviceApi.GetServiceApiOperations(); // invoke the operation string operationId = "57d2ef278aa04f0ad01d6cdc"; @@ -129,7 +129,7 @@ public async Task Exists_ApiManagementGetApiOperation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiOperation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperation.json // this example is just showing the usage of "ApiOperation_Get" 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 @@ -137,22 +137,22 @@ public async Task GetIfExists_ApiManagementGetApiOperation() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiOperationResource - ApiOperationCollection collection = api.GetApiOperations(); + // get the collection of this ServiceApiOperationResource + ServiceApiOperationCollection collection = serviceApi.GetServiceApiOperations(); // invoke the operation string operationId = "57d2ef278aa04f0ad01d6cdc"; - NullableResponse response = await collection.GetIfExistsAsync(operationId); - ApiOperationResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(operationId); + ServiceApiOperationResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -173,7 +173,7 @@ public async Task GetIfExists_ApiManagementGetApiOperation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiOperationPetStore() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPetStore.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationPetStore.json // this example is just showing the usage of "ApiOperation_Get" 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 @@ -181,21 +181,21 @@ public async Task Get_ApiManagementGetApiOperationPetStore() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "swagger-petstore"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiOperationResource - ApiOperationCollection collection = api.GetApiOperations(); + // get the collection of this ServiceApiOperationResource + ServiceApiOperationCollection collection = serviceApi.GetServiceApiOperations(); // invoke the operation string operationId = "loginUser"; - ApiOperationResource result = await collection.GetAsync(operationId); + ServiceApiOperationResource result = await collection.GetAsync(operationId); // 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 @@ -209,7 +209,7 @@ public async Task Get_ApiManagementGetApiOperationPetStore() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiOperationPetStore() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPetStore.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationPetStore.json // this example is just showing the usage of "ApiOperation_Get" 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 @@ -217,17 +217,17 @@ public async Task Exists_ApiManagementGetApiOperationPetStore() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "swagger-petstore"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiOperationResource - ApiOperationCollection collection = api.GetApiOperations(); + // get the collection of this ServiceApiOperationResource + ServiceApiOperationCollection collection = serviceApi.GetServiceApiOperations(); // invoke the operation string operationId = "loginUser"; @@ -241,7 +241,7 @@ public async Task Exists_ApiManagementGetApiOperationPetStore() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiOperationPetStore() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPetStore.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationPetStore.json // this example is just showing the usage of "ApiOperation_Get" 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 @@ -249,22 +249,22 @@ public async Task GetIfExists_ApiManagementGetApiOperationPetStore() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "swagger-petstore"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiOperationResource - ApiOperationCollection collection = api.GetApiOperations(); + // get the collection of this ServiceApiOperationResource + ServiceApiOperationCollection collection = serviceApi.GetServiceApiOperations(); // invoke the operation string operationId = "loginUser"; - NullableResponse response = await collection.GetIfExistsAsync(operationId); - ApiOperationResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(operationId); + ServiceApiOperationResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -285,7 +285,7 @@ public async Task GetIfExists_ApiManagementGetApiOperationPetStore() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiOperation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiOperation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -293,17 +293,17 @@ public async Task CreateOrUpdate_ApiManagementCreateApiOperation() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiOperationResource - ApiOperationCollection collection = api.GetApiOperations(); + // get the collection of this ServiceApiOperationResource + ServiceApiOperationCollection collection = serviceApi.GetServiceApiOperations(); // invoke the operation string operationId = "newoperations"; @@ -349,8 +349,8 @@ public async Task CreateOrUpdate_ApiManagementCreateApiOperation() Method = "POST", UriTemplate = "/user1", }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, operationId, data); - ApiOperationResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, operationId, data); + ServiceApiOperationResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiOperationResource.cs similarity index 63% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiOperationResource.cs index ee6c87473c27..ea199da88fbc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiOperationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiOperationResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiOperationResource + public partial class Sample_ServiceApiOperationResource { // ApiManagementHeadApiOperation [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiOperation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiOperation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiOperation.json // this example is just showing the usage of "ApiOperation_GetEntityTag" 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 @@ -31,18 +31,18 @@ public async Task GetEntityTag_ApiManagementHeadApiOperation() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; string operationId = "57d2ef278aa04f0ad01d6cdc"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // invoke the operation - bool result = await apiOperation.GetEntityTagAsync(); + bool result = await serviceApiOperation.GetEntityTagAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadApiOperation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiOperation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperation.json // this example is just showing the usage of "ApiOperation_Get" 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 @@ -60,18 +60,18 @@ public async Task Get_ApiManagementGetApiOperation() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; string operationId = "57d2ef278aa04f0ad01d6cdc"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // invoke the operation - ApiOperationResource result = await apiOperation.GetAsync(); + ServiceApiOperationResource result = await serviceApiOperation.GetAsync(); // 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 @@ -85,7 +85,7 @@ public async Task Get_ApiManagementGetApiOperation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiOperationPetStore() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiOperationPetStore.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiOperationPetStore.json // this example is just showing the usage of "ApiOperation_Get" 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 @@ -93,18 +93,18 @@ public async Task Get_ApiManagementGetApiOperationPetStore() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "swagger-petstore"; string operationId = "loginUser"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // invoke the operation - ApiOperationResource result = await apiOperation.GetAsync(); + ServiceApiOperationResource result = await serviceApiOperation.GetAsync(); // 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 @@ -118,7 +118,7 @@ public async Task Get_ApiManagementGetApiOperationPetStore() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateApiOperation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiOperation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateApiOperation.json // this example is just showing the usage of "ApiOperation_Update" 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 @@ -126,19 +126,19 @@ public async Task Update_ApiManagementUpdateApiOperation() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "echo-api"; string operationId = "operationId"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - ApiOperationPatch patch = new ApiOperationPatch() + OperationUpdateContract operationUpdateContract = new OperationUpdateContract() { TemplateParameters = { @@ -185,7 +185,7 @@ public async Task Update_ApiManagementUpdateApiOperation() Method = "GET", UriTemplate = "/resource", }; - ApiOperationResource result = await apiOperation.UpdateAsync(ifMatch, patch); + ServiceApiOperationResource result = await serviceApiOperation.UpdateAsync(ifMatch, operationUpdateContract); // 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 @@ -199,7 +199,7 @@ public async Task Update_ApiManagementUpdateApiOperation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiOperation() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiOperation.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiOperation.json // this example is just showing the usage of "ApiOperation_Delete" 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 @@ -207,19 +207,19 @@ public async Task Delete_ApiManagementDeleteApiOperation() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiOperationResource created on azure - // for more information of creating ApiOperationResource, please refer to the document of ApiOperationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiOperationResource created on azure + // for more information of creating ServiceApiOperationResource, please refer to the document of ServiceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; string operationId = "57d2ef278aa04f0ad01d6cdc"; - ResourceIdentifier apiOperationResourceId = ApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); - ApiOperationResource apiOperation = client.GetApiOperationResource(apiOperationResourceId); + ResourceIdentifier serviceApiOperationResourceId = ServiceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId); + ServiceApiOperationResource serviceApiOperation = client.GetServiceApiOperationResource(serviceApiOperationResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - await apiOperation.DeleteAsync(WaitUntil.Completed, ifMatch); + await serviceApiOperation.DeleteAsync(WaitUntil.Completed, ifMatch); Console.WriteLine($"Succeeded"); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiReleaseCollection.cs similarity index 60% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiReleaseCollection.cs index aa572c0db30f..12de967510d1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiReleaseCollection.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiReleaseCollection + public partial class Sample_ServiceApiReleaseCollection { // ApiManagementListApiReleases [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiReleases() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiReleases.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiReleases.json // this example is just showing the usage of "ApiRelease_ListByService" 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 @@ -30,20 +30,20 @@ public async Task GetAll_ApiManagementListApiReleases() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiReleaseResource - ApiReleaseCollection collection = api.GetApiReleases(); + // get the collection of this ServiceApiReleaseResource + ServiceApiReleaseCollection collection = serviceApi.GetServiceApiReleases(); // invoke the operation and iterate over the result - await foreach (ApiReleaseResource item in collection.GetAllAsync()) + await foreach (ServiceApiReleaseResource item in collection.GetAllAsync()) { // the variable item 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 @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListApiReleases() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiRelease() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRelease.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiRelease.json // this example is just showing the usage of "ApiRelease_Get" 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 @@ -68,21 +68,21 @@ public async Task Get_ApiManagementGetApiRelease() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiReleaseResource - ApiReleaseCollection collection = api.GetApiReleases(); + // get the collection of this ServiceApiReleaseResource + ServiceApiReleaseCollection collection = serviceApi.GetServiceApiReleases(); // invoke the operation string releaseId = "5a7cb545298324c53224a799"; - ApiReleaseResource result = await collection.GetAsync(releaseId); + ServiceApiReleaseResource result = await collection.GetAsync(releaseId); // 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 @@ -96,7 +96,7 @@ public async Task Get_ApiManagementGetApiRelease() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiRelease() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRelease.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiRelease.json // this example is just showing the usage of "ApiRelease_Get" 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 @@ -104,17 +104,17 @@ public async Task Exists_ApiManagementGetApiRelease() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiReleaseResource - ApiReleaseCollection collection = api.GetApiReleases(); + // get the collection of this ServiceApiReleaseResource + ServiceApiReleaseCollection collection = serviceApi.GetServiceApiReleases(); // invoke the operation string releaseId = "5a7cb545298324c53224a799"; @@ -128,7 +128,7 @@ public async Task Exists_ApiManagementGetApiRelease() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiRelease() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRelease.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiRelease.json // this example is just showing the usage of "ApiRelease_Get" 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 @@ -136,22 +136,22 @@ public async Task GetIfExists_ApiManagementGetApiRelease() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiReleaseResource - ApiReleaseCollection collection = api.GetApiReleases(); + // get the collection of this ServiceApiReleaseResource + ServiceApiReleaseCollection collection = serviceApi.GetServiceApiReleases(); // invoke the operation string releaseId = "5a7cb545298324c53224a799"; - NullableResponse response = await collection.GetIfExistsAsync(releaseId); - ApiReleaseResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(releaseId); + ServiceApiReleaseResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -172,7 +172,7 @@ public async Task GetIfExists_ApiManagementGetApiRelease() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiRelease() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiRelease.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -180,27 +180,27 @@ public async Task CreateOrUpdate_ApiManagementCreateApiRelease() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiReleaseResource - ApiReleaseCollection collection = api.GetApiReleases(); + // get the collection of this ServiceApiReleaseResource + ServiceApiReleaseCollection collection = serviceApi.GetServiceApiReleases(); // invoke the operation string releaseId = "testrev"; ApiReleaseData data = new ApiReleaseData() { - ApiId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), + ApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), Notes = "yahooagain", }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, releaseId, data); - ApiReleaseResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, releaseId, data); + ServiceApiReleaseResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiReleaseResource.cs similarity index 61% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiReleaseResource.cs index 867cea331810..7791ffb3a647 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiReleaseResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiReleaseResource.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiReleaseResource + public partial class Sample_ServiceApiReleaseResource { // ApiManagementHeadApiRelease [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiRelease() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiRelease.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiRelease.json // this example is just showing the usage of "ApiRelease_GetEntityTag" 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 @@ -30,18 +30,18 @@ public async Task GetEntityTag_ApiManagementHeadApiRelease() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiReleaseResource created on azure - // for more information of creating ApiReleaseResource, please refer to the document of ApiReleaseResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiReleaseResource created on azure + // for more information of creating ServiceApiReleaseResource, please refer to the document of ServiceApiReleaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "a1"; string releaseId = "5a7cb545298324c53224a799"; - ResourceIdentifier apiReleaseResourceId = ApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, releaseId); - ApiReleaseResource apiRelease = client.GetApiReleaseResource(apiReleaseResourceId); + ResourceIdentifier serviceApiReleaseResourceId = ServiceApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, releaseId); + ServiceApiReleaseResource serviceApiRelease = client.GetServiceApiReleaseResource(serviceApiReleaseResourceId); // invoke the operation - bool result = await apiRelease.GetEntityTagAsync(); + bool result = await serviceApiRelease.GetEntityTagAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadApiRelease() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiRelease() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRelease.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiRelease.json // this example is just showing the usage of "ApiRelease_Get" 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 @@ -59,18 +59,18 @@ public async Task Get_ApiManagementGetApiRelease() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiReleaseResource created on azure - // for more information of creating ApiReleaseResource, please refer to the document of ApiReleaseResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiReleaseResource created on azure + // for more information of creating ServiceApiReleaseResource, please refer to the document of ServiceApiReleaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "a1"; string releaseId = "5a7cb545298324c53224a799"; - ResourceIdentifier apiReleaseResourceId = ApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, releaseId); - ApiReleaseResource apiRelease = client.GetApiReleaseResource(apiReleaseResourceId); + ResourceIdentifier serviceApiReleaseResourceId = ServiceApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, releaseId); + ServiceApiReleaseResource serviceApiRelease = client.GetServiceApiReleaseResource(serviceApiReleaseResourceId); // invoke the operation - ApiReleaseResource result = await apiRelease.GetAsync(); + ServiceApiReleaseResource result = await serviceApiRelease.GetAsync(); // 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 @@ -84,7 +84,7 @@ public async Task Get_ApiManagementGetApiRelease() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateApiRelease() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiRelease.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateApiRelease.json // this example is just showing the usage of "ApiRelease_Update" 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 @@ -92,24 +92,24 @@ public async Task Update_ApiManagementUpdateApiRelease() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiReleaseResource created on azure - // for more information of creating ApiReleaseResource, please refer to the document of ApiReleaseResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiReleaseResource created on azure + // for more information of creating ServiceApiReleaseResource, please refer to the document of ServiceApiReleaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "a1"; string releaseId = "testrev"; - ResourceIdentifier apiReleaseResourceId = ApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, releaseId); - ApiReleaseResource apiRelease = client.GetApiReleaseResource(apiReleaseResourceId); + ResourceIdentifier serviceApiReleaseResourceId = ServiceApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, releaseId); + ServiceApiReleaseResource serviceApiRelease = client.GetServiceApiReleaseResource(serviceApiReleaseResourceId); // invoke the operation ETag ifMatch = new ETag("*"); ApiReleaseData data = new ApiReleaseData() { - ApiId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), + ApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"), Notes = "yahooagain", }; - ApiReleaseResource result = await apiRelease.UpdateAsync(ifMatch, data); + ServiceApiReleaseResource result = await serviceApiRelease.UpdateAsync(ifMatch, data); // 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 @@ -123,7 +123,7 @@ public async Task Update_ApiManagementUpdateApiRelease() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiRelease() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiRelease.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiRelease.json // this example is just showing the usage of "ApiRelease_Delete" 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 @@ -131,19 +131,19 @@ public async Task Delete_ApiManagementDeleteApiRelease() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiReleaseResource created on azure - // for more information of creating ApiReleaseResource, please refer to the document of ApiReleaseResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiReleaseResource created on azure + // for more information of creating ServiceApiReleaseResource, please refer to the document of ServiceApiReleaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "5a5fcc09124a7fa9b89f2f1d"; string releaseId = "testrev"; - ResourceIdentifier apiReleaseResourceId = ApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, releaseId); - ApiReleaseResource apiRelease = client.GetApiReleaseResource(apiReleaseResourceId); + ResourceIdentifier serviceApiReleaseResourceId = ServiceApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, releaseId); + ServiceApiReleaseResource serviceApiRelease = client.GetServiceApiReleaseResource(serviceApiReleaseResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - await apiRelease.DeleteAsync(WaitUntil.Completed, ifMatch); + await serviceApiRelease.DeleteAsync(WaitUntil.Completed, ifMatch); Console.WriteLine($"Succeeded"); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiResolverPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiResolverPolicyCollection.cs new file mode 100644 index 000000000000..c81ecc84f337 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiResolverPolicyCollection.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceApiResolverPolicyCollection + { + // ApiManagementListGraphQLApiResolverPolicies + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListGraphQLApiResolverPolicies() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListGraphQLApiResolverPolicies.json + // this example is just showing the usage of "GraphQLApiResolverPolicy_ListByResolver" 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 ResolverContractResource created on azure + // for more information of creating ResolverContractResource, please refer to the document of ResolverContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "599e2953193c3c0bd0b3e2fa"; + string resolverId = "599e29ab193c3c0bd0b3e2fb"; + ResourceIdentifier resolverContractResourceId = ResolverContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + ResolverContractResource resolverContract = client.GetResolverContractResource(resolverContractResourceId); + + // get the collection of this ServiceApiResolverPolicyResource + ServiceApiResolverPolicyCollection collection = resolverContract.GetServiceApiResolverPolicies(); + + // invoke the operation and iterate over the result + await foreach (ServiceApiResolverPolicyResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetGraphQLApiResolverPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetGraphQLApiResolverPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGraphQLApiResolverPolicy.json + // this example is just showing the usage of "GraphQLApiResolverPolicy_Get" 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 ResolverContractResource created on azure + // for more information of creating ResolverContractResource, please refer to the document of ResolverContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "5600b539c53f5b0062040001"; + string resolverId = "5600b53ac53f5b0062080006"; + ResourceIdentifier resolverContractResourceId = ResolverContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + ResolverContractResource resolverContract = client.GetResolverContractResource(resolverContractResourceId); + + // get the collection of this ServiceApiResolverPolicyResource + ServiceApiResolverPolicyCollection collection = resolverContract.GetServiceApiResolverPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + ServiceApiResolverPolicyResource result = await collection.GetAsync(policyId); + + // 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}"); + } + + // ApiManagementGetGraphQLApiResolverPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetGraphQLApiResolverPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGraphQLApiResolverPolicy.json + // this example is just showing the usage of "GraphQLApiResolverPolicy_Get" 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 ResolverContractResource created on azure + // for more information of creating ResolverContractResource, please refer to the document of ResolverContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "5600b539c53f5b0062040001"; + string resolverId = "5600b53ac53f5b0062080006"; + ResourceIdentifier resolverContractResourceId = ResolverContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + ResolverContractResource resolverContract = client.GetResolverContractResource(resolverContractResourceId); + + // get the collection of this ServiceApiResolverPolicyResource + ServiceApiResolverPolicyCollection collection = resolverContract.GetServiceApiResolverPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + bool result = await collection.ExistsAsync(policyId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetGraphQLApiResolverPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetGraphQLApiResolverPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGraphQLApiResolverPolicy.json + // this example is just showing the usage of "GraphQLApiResolverPolicy_Get" 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 ResolverContractResource created on azure + // for more information of creating ResolverContractResource, please refer to the document of ResolverContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "5600b539c53f5b0062040001"; + string resolverId = "5600b53ac53f5b0062080006"; + ResourceIdentifier resolverContractResourceId = ResolverContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + ResolverContractResource resolverContract = client.GetResolverContractResource(resolverContractResourceId); + + // get the collection of this ServiceApiResolverPolicyResource + ServiceApiResolverPolicyCollection collection = resolverContract.GetServiceApiResolverPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + NullableResponse response = await collection.GetIfExistsAsync(policyId); + ServiceApiResolverPolicyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateGraphQLApiResolverPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateGraphQLApiResolverPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGraphQLApiResolverPolicy.json + // this example is just showing the usage of "GraphQLApiResolverPolicy_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 ResolverContractResource created on azure + // for more information of creating ResolverContractResource, please refer to the document of ResolverContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "5600b57e7e8880006a040001"; + string resolverId = "5600b57e7e8880006a080001"; + ResourceIdentifier resolverContractResourceId = ResolverContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + ResolverContractResource resolverContract = client.GetResolverContractResource(resolverContractResourceId); + + // get the collection of this ServiceApiResolverPolicyResource + ServiceApiResolverPolicyCollection collection = resolverContract.GetServiceApiResolverPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + PolicyContractData data = new PolicyContractData() + { + Value = "GET/api/users", + Format = PolicyContentFormat.Xml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyId, data, ifMatch: ifMatch); + ServiceApiResolverPolicyResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiResolverPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiResolverPolicyResource.cs new file mode 100644 index 000000000000..d161a710d63e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiResolverPolicyResource.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceApiResolverPolicyResource + { + // ApiManagementHeadGraphQLApiResolverPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadGraphQLApiResolverPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadGraphQLApiResolverPolicy.json + // this example is just showing the usage of "GraphQLApiResolverPolicy_GetEntityTag" 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 ServiceApiResolverPolicyResource created on azure + // for more information of creating ServiceApiResolverPolicyResource, please refer to the document of ServiceApiResolverPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "5600b539c53f5b0062040001"; + string resolverId = "5600b53ac53f5b0062080006"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceApiResolverPolicyResourceId = ServiceApiResolverPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId); + ServiceApiResolverPolicyResource serviceApiResolverPolicy = client.GetServiceApiResolverPolicyResource(serviceApiResolverPolicyResourceId); + + // invoke the operation + bool result = await serviceApiResolverPolicy.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetGraphQLApiResolverPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetGraphQLApiResolverPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGraphQLApiResolverPolicy.json + // this example is just showing the usage of "GraphQLApiResolverPolicy_Get" 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 ServiceApiResolverPolicyResource created on azure + // for more information of creating ServiceApiResolverPolicyResource, please refer to the document of ServiceApiResolverPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "5600b539c53f5b0062040001"; + string resolverId = "5600b53ac53f5b0062080006"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceApiResolverPolicyResourceId = ServiceApiResolverPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId); + ServiceApiResolverPolicyResource serviceApiResolverPolicy = client.GetServiceApiResolverPolicyResource(serviceApiResolverPolicyResourceId); + + // invoke the operation + ServiceApiResolverPolicyResource result = await serviceApiResolverPolicy.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateGraphQLApiResolverPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateGraphQLApiResolverPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGraphQLApiResolverPolicy.json + // this example is just showing the usage of "GraphQLApiResolverPolicy_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 ServiceApiResolverPolicyResource created on azure + // for more information of creating ServiceApiResolverPolicyResource, please refer to the document of ServiceApiResolverPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "5600b57e7e8880006a040001"; + string resolverId = "5600b57e7e8880006a080001"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceApiResolverPolicyResourceId = ServiceApiResolverPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId); + ServiceApiResolverPolicyResource serviceApiResolverPolicy = client.GetServiceApiResolverPolicyResource(serviceApiResolverPolicyResourceId); + + // invoke the operation + PolicyContractData data = new PolicyContractData() + { + Value = "GET/api/users", + Format = PolicyContentFormat.Xml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await serviceApiResolverPolicy.UpdateAsync(WaitUntil.Completed, data, ifMatch: ifMatch); + ServiceApiResolverPolicyResource 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}"); + } + + // ApiManagementDeleteGraphQLApiResolverPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteGraphQLApiResolverPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteGraphQLApiResolverPolicy.json + // this example is just showing the usage of "GraphQLApiResolverPolicy_Delete" 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 ServiceApiResolverPolicyResource created on azure + // for more information of creating ServiceApiResolverPolicyResource, please refer to the document of ServiceApiResolverPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string apiId = "testapi"; + string resolverId = "testResolver"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceApiResolverPolicyResourceId = ServiceApiResolverPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId); + ServiceApiResolverPolicyResource serviceApiResolverPolicy = client.GetServiceApiResolverPolicyResource(serviceApiResolverPolicyResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceApiResolverPolicy.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiResource.cs similarity index 62% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiResource.cs index 8ed636b71382..5d5f6b7e31d0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiResource + public partial class Sample_ServiceApiResource { // ApiManagementHeadApi [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApi.json // this example is just showing the usage of "Api_GetEntityTag" 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 @@ -31,17 +31,17 @@ public async Task GetEntityTag_ApiManagementHeadApi() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // invoke the operation - bool result = await api.GetEntityTagAsync(); + bool result = await serviceApi.GetEntityTagAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiContract() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiContract.json // this example is just showing the usage of "Api_Get" 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 @@ -59,17 +59,17 @@ public async Task Get_ApiManagementGetApiContract() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // invoke the operation - ApiResource result = await api.GetAsync(); + ServiceApiResource result = await serviceApi.GetAsync(); // 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 @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetApiContract() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiRevisionContract() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiRevision.json // this example is just showing the usage of "Api_Get" 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 @@ -91,17 +91,17 @@ public async Task Get_ApiManagementGetApiRevisionContract() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "echo-api;rev=3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // invoke the operation - ApiResource result = await api.GetAsync(); + ServiceApiResource result = await serviceApi.GetAsync(); // 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 @@ -115,7 +115,7 @@ public async Task Get_ApiManagementGetApiRevisionContract() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateApi.json // this example is just showing the usage of "Api_Update" 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 @@ -123,24 +123,24 @@ public async Task Update_ApiManagementUpdateApi() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "echo-api"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - ApiPatch patch = new ApiPatch() + ApiUpdateContract apiUpdateContract = new ApiUpdateContract() { DisplayName = "Echo API New", ServiceUri = new Uri("http://echoapi.cloudapp.net/api2"), Path = "newecho", }; - ApiResource result = await api.UpdateAsync(ifMatch, patch); + ServiceApiResource result = await serviceApi.UpdateAsync(ifMatch, apiUpdateContract); // 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 @@ -154,7 +154,7 @@ public async Task Update_ApiManagementUpdateApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApi.json // this example is just showing the usage of "Api_Delete" 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 @@ -162,18 +162,18 @@ public async Task Delete_ApiManagementDeleteApi() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "echo-api"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - await api.DeleteAsync(WaitUntil.Completed, ifMatch); + await serviceApi.DeleteAsync(WaitUntil.Completed, ifMatch); Console.WriteLine($"Succeeded"); } @@ -183,7 +183,7 @@ public async Task Delete_ApiManagementDeleteApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetApiRevisionsByService_ApiManagementListApiRevisions() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiRevisions.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiRevisions.json // this example is just showing the usage of "ApiRevision_ListByService" 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 @@ -191,17 +191,17 @@ public async Task GetApiRevisionsByService_ApiManagementListApiRevisions() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // invoke the operation and iterate over the result - await foreach (ApiRevisionContract item in api.GetApiRevisionsByServiceAsync()) + await foreach (ApiRevisionContract item in serviceApi.GetApiRevisionsByServiceAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -214,7 +214,7 @@ public async Task GetApiRevisionsByService_ApiManagementListApiRevisions() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetApiProducts_ApiManagementListApiProducts() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiProducts.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiProducts.json // this example is just showing the usage of "ApiProduct_ListByApis" 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 @@ -222,23 +222,20 @@ public async Task GetApiProducts_ApiManagementListApiProducts() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // invoke the operation and iterate over the result - await foreach (ApiManagementProductResource item in api.GetApiProductsAsync()) + await foreach (ApiManagementProductData item in serviceApi.GetApiProductsAsync()) { - // the variable item 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 - ApiManagementProductData resourceData = item.Data; // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded on id: {item.Id}"); } Console.WriteLine($"Succeeded"); @@ -249,7 +246,7 @@ public async Task GetApiProducts_ApiManagementListApiProducts() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetOperationsByTags_ApiManagementListApiOperationsByTags() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiOperationsByTags.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiOperationsByTags.json // this example is just showing the usage of "Operation_ListByTags" 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 @@ -257,17 +254,17 @@ public async Task GetOperationsByTags_ApiManagementListApiOperationsByTags() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + 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); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); // invoke the operation and iterate over the result - await foreach (TagResourceContractDetails item in api.GetOperationsByTagsAsync()) + await foreach (TagResourceContractDetails item in serviceApi.GetOperationsByTagsAsync()) { Console.WriteLine($"Succeeded: {item}"); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiSchemaCollection.cs similarity index 75% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiSchemaCollection.cs index 4cbec153e638..74ffa91e70bc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiSchemaCollection.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiSchemaCollection + public partial class Sample_ServiceApiSchemaCollection { // ApiManagementListApiSchemas [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiSchemas() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiSchemas.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiSchemas.json // this example is just showing the usage of "ApiSchema_ListByApi" 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 @@ -30,20 +30,20 @@ public async Task GetAll_ApiManagementListApiSchemas() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d5b28d1f7fab116c282650"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiSchemaResource - ApiSchemaCollection collection = api.GetApiSchemas(); + // get the collection of this ServiceApiSchemaResource + ServiceApiSchemaCollection collection = serviceApi.GetServiceApiSchemas(); // invoke the operation and iterate over the result - await foreach (ApiSchemaResource item in collection.GetAllAsync()) + await foreach (ServiceApiSchemaResource item in collection.GetAllAsync()) { // the variable item 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 @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListApiSchemas() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiSchema() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiSchema.json // this example is just showing the usage of "ApiSchema_Get" 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 @@ -68,21 +68,21 @@ public async Task Get_ApiManagementGetApiSchema() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiSchemaResource - ApiSchemaCollection collection = api.GetApiSchemas(); + // get the collection of this ServiceApiSchemaResource + ServiceApiSchemaCollection collection = serviceApi.GetServiceApiSchemas(); // invoke the operation string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; - ApiSchemaResource result = await collection.GetAsync(schemaId); + ServiceApiSchemaResource result = await collection.GetAsync(schemaId); // 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 @@ -96,7 +96,7 @@ public async Task Get_ApiManagementGetApiSchema() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiSchema() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiSchema.json // this example is just showing the usage of "ApiSchema_Get" 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 @@ -104,17 +104,17 @@ public async Task Exists_ApiManagementGetApiSchema() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiSchemaResource - ApiSchemaCollection collection = api.GetApiSchemas(); + // get the collection of this ServiceApiSchemaResource + ServiceApiSchemaCollection collection = serviceApi.GetServiceApiSchemas(); // invoke the operation string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; @@ -128,7 +128,7 @@ public async Task Exists_ApiManagementGetApiSchema() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiSchema() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiSchema.json // this example is just showing the usage of "ApiSchema_Get" 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 @@ -136,22 +136,22 @@ public async Task GetIfExists_ApiManagementGetApiSchema() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiSchemaResource - ApiSchemaCollection collection = api.GetApiSchemas(); + // get the collection of this ServiceApiSchemaResource + ServiceApiSchemaCollection collection = serviceApi.GetServiceApiSchemas(); // invoke the operation string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; - NullableResponse response = await collection.GetIfExistsAsync(schemaId); - ApiSchemaResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(schemaId); + ServiceApiSchemaResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -172,7 +172,7 @@ public async Task GetIfExists_ApiManagementGetApiSchema() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiSchema() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateApiSchema.json // this example is just showing the usage of "ApiSchema_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 @@ -180,17 +180,17 @@ public async Task CreateOrUpdate_ApiManagementCreateApiSchema() // 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 = "subid"; + // this example assumes you already have this ServiceApiResource created on azure + // for more information of creating ServiceApiResource, please refer to the document of ServiceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; - ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); - ApiResource api = client.GetApiResource(apiResourceId); + ResourceIdentifier serviceApiResourceId = ServiceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId); + ServiceApiResource serviceApi = client.GetServiceApiResource(serviceApiResourceId); - // get the collection of this ApiSchemaResource - ApiSchemaCollection collection = api.GetApiSchemas(); + // get the collection of this ServiceApiSchemaResource + ServiceApiSchemaCollection collection = serviceApi.GetServiceApiSchemas(); // invoke the operation string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; @@ -199,8 +199,8 @@ public async Task CreateOrUpdate_ApiManagementCreateApiSchema() ContentType = "application/vnd.ms-azure-apim.xsd+xml", Value = "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaId, data); - ApiSchemaResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaId, data); + ServiceApiSchemaResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiSchemaResource.cs similarity index 78% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiSchemaResource.cs index cce812b8cc72..9c2d3f6342a7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiSchemaResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiSchemaResource.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiSchemaResource + public partial class Sample_ServiceApiSchemaResource { // ApiManagementHeadApiSchema [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiSchema() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiSchema.json // this example is just showing the usage of "ApiSchema_GetEntityTag" 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 @@ -30,18 +30,18 @@ public async Task GetEntityTag_ApiManagementHeadApiSchema() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiSchemaResource created on azure - // for more information of creating ApiSchemaResource, please refer to the document of ApiSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiSchemaResource created on azure + // for more information of creating ServiceApiSchemaResource, please refer to the document of ServiceApiSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "57d1f7558aa04f15146d9d8a"; string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; - ResourceIdentifier apiSchemaResourceId = ApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, schemaId); - ApiSchemaResource apiSchema = client.GetApiSchemaResource(apiSchemaResourceId); + ResourceIdentifier serviceApiSchemaResourceId = ServiceApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, schemaId); + ServiceApiSchemaResource serviceApiSchema = client.GetServiceApiSchemaResource(serviceApiSchemaResourceId); // invoke the operation - bool result = await apiSchema.GetEntityTagAsync(); + bool result = await serviceApiSchema.GetEntityTagAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadApiSchema() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiSchema() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiSchema.json // this example is just showing the usage of "ApiSchema_Get" 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 @@ -59,18 +59,18 @@ public async Task Get_ApiManagementGetApiSchema() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiSchemaResource created on azure - // for more information of creating ApiSchemaResource, please refer to the document of ApiSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiSchemaResource created on azure + // for more information of creating ServiceApiSchemaResource, please refer to the document of ServiceApiSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; - ResourceIdentifier apiSchemaResourceId = ApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, schemaId); - ApiSchemaResource apiSchema = client.GetApiSchemaResource(apiSchemaResourceId); + ResourceIdentifier serviceApiSchemaResourceId = ServiceApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, schemaId); + ServiceApiSchemaResource serviceApiSchema = client.GetServiceApiSchemaResource(serviceApiSchemaResourceId); // invoke the operation - ApiSchemaResource result = await apiSchema.GetAsync(); + ServiceApiSchemaResource result = await serviceApiSchema.GetAsync(); // 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 @@ -84,7 +84,7 @@ public async Task Get_ApiManagementGetApiSchema() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateApiSchema() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateApiSchema.json // this example is just showing the usage of "ApiSchema_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 @@ -92,15 +92,15 @@ public async Task Update_ApiManagementCreateApiSchema() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiSchemaResource created on azure - // for more information of creating ApiSchemaResource, please refer to the document of ApiSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiSchemaResource created on azure + // for more information of creating ServiceApiSchemaResource, please refer to the document of ServiceApiSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d6bb8f1f7fab13dc67ec9b"; string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; - ResourceIdentifier apiSchemaResourceId = ApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, schemaId); - ApiSchemaResource apiSchema = client.GetApiSchemaResource(apiSchemaResourceId); + ResourceIdentifier serviceApiSchemaResourceId = ServiceApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, schemaId); + ServiceApiSchemaResource serviceApiSchema = client.GetServiceApiSchemaResource(serviceApiSchemaResourceId); // invoke the operation ApiSchemaData data = new ApiSchemaData() @@ -108,8 +108,8 @@ public async Task Update_ApiManagementCreateApiSchema() ContentType = "application/vnd.ms-azure-apim.xsd+xml", Value = "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", }; - ArmOperation lro = await apiSchema.UpdateAsync(WaitUntil.Completed, data); - ApiSchemaResource result = lro.Value; + ArmOperation lro = await serviceApiSchema.UpdateAsync(WaitUntil.Completed, data); + ServiceApiSchemaResource 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 @@ -123,7 +123,7 @@ public async Task Update_ApiManagementCreateApiSchema() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiSchema() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiSchema.json // this example is just showing the usage of "ApiSchema_Delete" 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 @@ -131,19 +131,19 @@ public async Task Delete_ApiManagementDeleteApiSchema() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiSchemaResource created on azure - // for more information of creating ApiSchemaResource, please refer to the document of ApiSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiSchemaResource created on azure + // for more information of creating ServiceApiSchemaResource, please refer to the document of ServiceApiSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string apiId = "59d5b28d1f7fab116c282650"; string schemaId = "59d5b28e1f7fab116402044e"; - ResourceIdentifier apiSchemaResourceId = ApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, schemaId); - ApiSchemaResource apiSchema = client.GetApiSchemaResource(apiSchemaResourceId); + ResourceIdentifier serviceApiSchemaResourceId = ServiceApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, schemaId); + ServiceApiSchemaResource serviceApiSchema = client.GetServiceApiSchemaResource(serviceApiSchemaResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - await apiSchema.DeleteAsync(WaitUntil.Completed, ifMatch); + await serviceApiSchema.DeleteAsync(WaitUntil.Completed, ifMatch); Console.WriteLine($"Succeeded"); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiVersionSetCollection.cs similarity index 80% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiVersionSetCollection.cs index 989aac4df500..08866d6e5c78 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiVersionSetCollection.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiVersionSetCollection + public partial class Sample_ServiceApiVersionSetCollection { // ApiManagementListApiVersionSets [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListApiVersionSets() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListApiVersionSets.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListApiVersionSets.json // this example is just showing the usage of "ApiVersionSet_ListByService" 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 @@ -33,17 +33,17 @@ public async Task GetAll_ApiManagementListApiVersionSets() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiVersionSetResource + ServiceApiVersionSetCollection collection = apiManagementService.GetServiceApiVersionSets(); // invoke the operation and iterate over the result - await foreach (ApiVersionSetResource item in collection.GetAllAsync()) + await foreach (ServiceApiVersionSetResource item in collection.GetAllAsync()) { // the variable item 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 @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListApiVersionSets() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiVersionSet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiVersionSet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiVersionSet.json // this example is just showing the usage of "ApiVersionSet_Get" 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 @@ -70,18 +70,18 @@ public async Task Get_ApiManagementGetApiVersionSet() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiVersionSetResource + ServiceApiVersionSetCollection collection = apiManagementService.GetServiceApiVersionSets(); // invoke the operation string versionSetId = "vs1"; - ApiVersionSetResource result = await collection.GetAsync(versionSetId); + ServiceApiVersionSetResource result = await collection.GetAsync(versionSetId); // 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 @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetApiVersionSet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetApiVersionSet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiVersionSet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiVersionSet.json // this example is just showing the usage of "ApiVersionSet_Get" 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 @@ -105,14 +105,14 @@ public async Task Exists_ApiManagementGetApiVersionSet() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiVersionSetResource + ServiceApiVersionSetCollection collection = apiManagementService.GetServiceApiVersionSets(); // invoke the operation string versionSetId = "vs1"; @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetApiVersionSet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetApiVersionSet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiVersionSet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiVersionSet.json // this example is just showing the usage of "ApiVersionSet_Get" 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 @@ -136,19 +136,19 @@ public async Task GetIfExists_ApiManagementGetApiVersionSet() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiVersionSetResource + ServiceApiVersionSetCollection collection = apiManagementService.GetServiceApiVersionSets(); // invoke the operation string versionSetId = "vs1"; - NullableResponse response = await collection.GetIfExistsAsync(versionSetId); - ApiVersionSetResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(versionSetId); + ServiceApiVersionSetResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetApiVersionSet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateApiVersionSet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateApiVersionSet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 @@ -179,14 +179,14 @@ public async Task CreateOrUpdate_ApiManagementCreateApiVersionSet() // 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 = "subid"; + 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(); + // get the collection of this ServiceApiVersionSetResource + ServiceApiVersionSetCollection collection = apiManagementService.GetServiceApiVersionSets(); // invoke the operation string versionSetId = "api1"; @@ -196,8 +196,8 @@ public async Task CreateOrUpdate_ApiManagementCreateApiVersionSet() DisplayName = "api set 1", VersioningScheme = VersioningScheme.Segment, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, versionSetId, data); - ApiVersionSetResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, versionSetId, data); + ServiceApiVersionSetResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiVersionSetResource.cs similarity index 60% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiVersionSetResource.cs index beeb227981df..a474ff8961fe 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiVersionSetResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiVersionSetResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiVersionSetResource + public partial class Sample_ServiceApiVersionSetResource { // ApiManagementHeadApiVersionSet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApiVersionSet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadApiVersionSet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiVersionSet.json // this example is just showing the usage of "ApiVersionSet_GetEntityTag" 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 @@ -31,17 +31,17 @@ public async Task GetEntityTag_ApiManagementHeadApiVersionSet() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiVersionSetResource created on azure - // for more information of creating ApiVersionSetResource, please refer to the document of ApiVersionSetResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiVersionSetResource created on azure + // for more information of creating ServiceApiVersionSetResource, please refer to the document of ServiceApiVersionSetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string versionSetId = "vs1"; - ResourceIdentifier apiVersionSetResourceId = ApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, versionSetId); - ApiVersionSetResource apiVersionSet = client.GetApiVersionSetResource(apiVersionSetResourceId); + ResourceIdentifier serviceApiVersionSetResourceId = ServiceApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, versionSetId); + ServiceApiVersionSetResource serviceApiVersionSet = client.GetServiceApiVersionSetResource(serviceApiVersionSetResourceId); // invoke the operation - bool result = await apiVersionSet.GetEntityTagAsync(); + bool result = await serviceApiVersionSet.GetEntityTagAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadApiVersionSet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetApiVersionSet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiVersionSet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiVersionSet.json // this example is just showing the usage of "ApiVersionSet_Get" 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 @@ -59,17 +59,17 @@ public async Task Get_ApiManagementGetApiVersionSet() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiVersionSetResource created on azure - // for more information of creating ApiVersionSetResource, please refer to the document of ApiVersionSetResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiVersionSetResource created on azure + // for more information of creating ServiceApiVersionSetResource, please refer to the document of ServiceApiVersionSetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string versionSetId = "vs1"; - ResourceIdentifier apiVersionSetResourceId = ApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, versionSetId); - ApiVersionSetResource apiVersionSet = client.GetApiVersionSetResource(apiVersionSetResourceId); + ResourceIdentifier serviceApiVersionSetResourceId = ServiceApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, versionSetId); + ServiceApiVersionSetResource serviceApiVersionSet = client.GetServiceApiVersionSetResource(serviceApiVersionSetResourceId); // invoke the operation - ApiVersionSetResource result = await apiVersionSet.GetAsync(); + ServiceApiVersionSetResource result = await serviceApiVersionSet.GetAsync(); // 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 @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetApiVersionSet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateApiVersionSet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateApiVersionSet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateApiVersionSet.json // this example is just showing the usage of "ApiVersionSet_Update" 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 @@ -91,24 +91,24 @@ public async Task Update_ApiManagementUpdateApiVersionSet() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiVersionSetResource created on azure - // for more information of creating ApiVersionSetResource, please refer to the document of ApiVersionSetResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiVersionSetResource created on azure + // for more information of creating ServiceApiVersionSetResource, please refer to the document of ServiceApiVersionSetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string versionSetId = "vs1"; - ResourceIdentifier apiVersionSetResourceId = ApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, versionSetId); - ApiVersionSetResource apiVersionSet = client.GetApiVersionSetResource(apiVersionSetResourceId); + ResourceIdentifier serviceApiVersionSetResourceId = ServiceApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, versionSetId); + ServiceApiVersionSetResource serviceApiVersionSet = client.GetServiceApiVersionSetResource(serviceApiVersionSetResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - ApiVersionSetPatch patch = new ApiVersionSetPatch() + ApiVersionSetUpdateParameters apiVersionSetUpdateParameters = new ApiVersionSetUpdateParameters() { Description = "Version configuration", DisplayName = "api set 1", VersioningScheme = VersioningScheme.Segment, }; - ApiVersionSetResource result = await apiVersionSet.UpdateAsync(ifMatch, patch); + ServiceApiVersionSetResource result = await serviceApiVersionSet.UpdateAsync(ifMatch, apiVersionSetUpdateParameters); // 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 @@ -122,7 +122,7 @@ public async Task Update_ApiManagementUpdateApiVersionSet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteApiVersionSet() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteApiVersionSet.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiVersionSet.json // this example is just showing the usage of "ApiVersionSet_Delete" 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 @@ -130,18 +130,18 @@ public async Task Delete_ApiManagementDeleteApiVersionSet() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiVersionSetResource created on azure - // for more information of creating ApiVersionSetResource, please refer to the document of ApiVersionSetResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceApiVersionSetResource created on azure + // for more information of creating ServiceApiVersionSetResource, please refer to the document of ServiceApiVersionSetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string versionSetId = "a1"; - ResourceIdentifier apiVersionSetResourceId = ApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, versionSetId); - ApiVersionSetResource apiVersionSet = client.GetApiVersionSetResource(apiVersionSetResourceId); + ResourceIdentifier serviceApiVersionSetResourceId = ServiceApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, versionSetId); + ServiceApiVersionSetResource serviceApiVersionSet = client.GetServiceApiVersionSetResource(serviceApiVersionSetResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - await apiVersionSet.DeleteAsync(WaitUntil.Completed, ifMatch); + await serviceApiVersionSet.DeleteAsync(WaitUntil.Completed, ifMatch); Console.WriteLine($"Succeeded"); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiWikiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiWikiResource.cs new file mode 100644 index 000000000000..dfd446aedfb2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceApiWikiResource.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceApiWikiResource + { + // ApiManagementHeadApiWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadApiWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadApiWiki.json + // this example is just showing the usage of "ApiWiki_GetEntityTag" 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 + bool result = await serviceApiWiki.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetApiWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetApiWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetApiWiki.json + // this example is just showing the usage of "ApiWiki_Get" 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 + ServiceApiWikiResource result = await serviceApiWiki.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateApiWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateApiWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-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 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}"); + } + + // ApiManagementUpdateApiWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateApiWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateApiWiki.json + // this example is just showing the usage of "ApiWiki_Update" 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 + ETag ifMatch = new ETag("*"); + WikiUpdateContract wikiUpdateContract = new WikiUpdateContract() + { + Documents = +{ +new WikiDocumentationContract() +{ +DocumentationId = "docId1", +} +}, + }; + ServiceApiWikiResource result = await serviceApiWiki.UpdateAsync(ifMatch, wikiUpdateContract); + + // 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}"); + } + + // ApiManagementDeleteApiWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteApiWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteApiWiki.json + // this example is just showing the usage of "ApiWiki_Delete" 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 + ETag ifMatch = new ETag("*"); + await serviceApiWiki.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceGroupCollection.cs similarity index 79% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceGroupCollection.cs index 7c3385402ade..e4bd2c0cfcb1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceGroupCollection.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementGroupCollection + public partial class Sample_ServiceGroupCollection { // ApiManagementListGroups [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListGroups() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGroups.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListGroups.json // this example is just showing the usage of "Group_ListByService" 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 @@ -33,17 +33,17 @@ public async Task GetAll_ApiManagementListGroups() // 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 = "subid"; + 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 ApiManagementGroupResource - ApiManagementGroupCollection collection = apiManagementService.GetApiManagementGroups(); + // get the collection of this ServiceGroupResource + ServiceGroupCollection collection = apiManagementService.GetServiceGroups(); // invoke the operation and iterate over the result - await foreach (ApiManagementGroupResource item in collection.GetAllAsync()) + await foreach (ServiceGroupResource item in collection.GetAllAsync()) { // the variable item 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 @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListGroups() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGroup.json // this example is just showing the usage of "Group_Get" 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 @@ -70,18 +70,18 @@ public async Task Get_ApiManagementGetGroup() // 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 = "subid"; + 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 ApiManagementGroupResource - ApiManagementGroupCollection collection = apiManagementService.GetApiManagementGroups(); + // get the collection of this ServiceGroupResource + ServiceGroupCollection collection = apiManagementService.GetServiceGroups(); // invoke the operation string groupId = "59306a29e4bbd510dc24e5f9"; - ApiManagementGroupResource result = await collection.GetAsync(groupId); + ServiceGroupResource result = await collection.GetAsync(groupId); // 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 @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGroup.json // this example is just showing the usage of "Group_Get" 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 @@ -105,14 +105,14 @@ public async Task Exists_ApiManagementGetGroup() // 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 = "subid"; + 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 ApiManagementGroupResource - ApiManagementGroupCollection collection = apiManagementService.GetApiManagementGroups(); + // get the collection of this ServiceGroupResource + ServiceGroupCollection collection = apiManagementService.GetServiceGroups(); // invoke the operation string groupId = "59306a29e4bbd510dc24e5f9"; @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGroup.json // this example is just showing the usage of "Group_Get" 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 @@ -136,19 +136,19 @@ public async Task GetIfExists_ApiManagementGetGroup() // 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 = "subid"; + 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 ApiManagementGroupResource - ApiManagementGroupCollection collection = apiManagementService.GetApiManagementGroups(); + // get the collection of this ServiceGroupResource + ServiceGroupCollection collection = apiManagementService.GetServiceGroups(); // invoke the operation string groupId = "59306a29e4bbd510dc24e5f9"; - NullableResponse response = await collection.GetIfExistsAsync(groupId); - ApiManagementGroupResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(groupId); + ServiceGroupResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGroup.json // this example is just showing the usage of "Group_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 @@ -179,23 +179,23 @@ public async Task CreateOrUpdate_ApiManagementCreateGroup() // 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 = "subid"; + 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 ApiManagementGroupResource - ApiManagementGroupCollection collection = apiManagementService.GetApiManagementGroups(); + // get the collection of this ServiceGroupResource + ServiceGroupCollection collection = apiManagementService.GetServiceGroups(); // invoke the operation string groupId = "tempgroup"; - ApiManagementGroupCreateOrUpdateContent content = new ApiManagementGroupCreateOrUpdateContent() + GroupCreateParameters groupCreateParameters = new GroupCreateParameters() { DisplayName = "temp group", }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, groupId, content); - ApiManagementGroupResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, groupId, groupCreateParameters); + ServiceGroupResource 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 @@ -209,7 +209,7 @@ public async Task CreateOrUpdate_ApiManagementCreateGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateGroupExternal() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGroupExternal.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGroupExternal.json // this example is just showing the usage of "Group_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 @@ -219,26 +219,26 @@ public async Task CreateOrUpdate_ApiManagementCreateGroupExternal() // 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 = "subid"; + 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 ApiManagementGroupResource - ApiManagementGroupCollection collection = apiManagementService.GetApiManagementGroups(); + // get the collection of this ServiceGroupResource + ServiceGroupCollection collection = apiManagementService.GetServiceGroups(); // invoke the operation string groupId = "aadGroup"; - ApiManagementGroupCreateOrUpdateContent content = new ApiManagementGroupCreateOrUpdateContent() + GroupCreateParameters groupCreateParameters = new GroupCreateParameters() { DisplayName = "NewGroup (samiraad.onmicrosoft.com)", Description = "new group to test", ApiManagementGroupType = ApiManagementGroupType.External, ExternalId = "aad://samiraad.onmicrosoft.com/groups/83cf2753-5831-4675-bc0e-2f8dc067c58d", }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, groupId, content); - ApiManagementGroupResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, groupId, groupCreateParameters); + ServiceGroupResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceGroupResource.cs similarity index 60% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceGroupResource.cs index 6babb793324d..e4a4dec2d321 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGroupResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceGroupResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementGroupResource + public partial class Sample_ServiceGroupResource { // ApiManagementHeadGroup [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadGroup.json // this example is just showing the usage of "Group_GetEntityTag" 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 @@ -31,17 +31,17 @@ public async Task GetEntityTag_ApiManagementHeadGroup() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGroupResource created on azure - // for more information of creating ApiManagementGroupResource, please refer to the document of ApiManagementGroupResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceGroupResource created on azure + // for more information of creating ServiceGroupResource, please refer to the document of ServiceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string groupId = "59306a29e4bbd510dc24e5f9"; - ResourceIdentifier apiManagementGroupResourceId = ApiManagementGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); - ApiManagementGroupResource apiManagementGroup = client.GetApiManagementGroupResource(apiManagementGroupResourceId); + ResourceIdentifier serviceGroupResourceId = ServiceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); + ServiceGroupResource serviceGroup = client.GetServiceGroupResource(serviceGroupResourceId); // invoke the operation - bool result = await apiManagementGroup.GetEntityTagAsync(); + bool result = await serviceGroup.GetEntityTagAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGroup.json // this example is just showing the usage of "Group_Get" 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 @@ -59,17 +59,17 @@ public async Task Get_ApiManagementGetGroup() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGroupResource created on azure - // for more information of creating ApiManagementGroupResource, please refer to the document of ApiManagementGroupResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceGroupResource created on azure + // for more information of creating ServiceGroupResource, please refer to the document of ServiceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string groupId = "59306a29e4bbd510dc24e5f9"; - ResourceIdentifier apiManagementGroupResourceId = ApiManagementGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); - ApiManagementGroupResource apiManagementGroup = client.GetApiManagementGroupResource(apiManagementGroupResourceId); + ResourceIdentifier serviceGroupResourceId = ServiceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); + ServiceGroupResource serviceGroup = client.GetServiceGroupResource(serviceGroupResourceId); // invoke the operation - ApiManagementGroupResource result = await apiManagementGroup.GetAsync(); + ServiceGroupResource result = await serviceGroup.GetAsync(); // 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 @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateGroup.json // this example is just showing the usage of "Group_Update" 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 @@ -91,22 +91,22 @@ public async Task Update_ApiManagementUpdateGroup() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGroupResource created on azure - // for more information of creating ApiManagementGroupResource, please refer to the document of ApiManagementGroupResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceGroupResource created on azure + // for more information of creating ServiceGroupResource, please refer to the document of ServiceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string groupId = "tempgroup"; - ResourceIdentifier apiManagementGroupResourceId = ApiManagementGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); - ApiManagementGroupResource apiManagementGroup = client.GetApiManagementGroupResource(apiManagementGroupResourceId); + ResourceIdentifier serviceGroupResourceId = ServiceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); + ServiceGroupResource serviceGroup = client.GetServiceGroupResource(serviceGroupResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - ApiManagementGroupPatch patch = new ApiManagementGroupPatch() + GroupUpdateParameters groupUpdateParameters = new GroupUpdateParameters() { DisplayName = "temp group", }; - ApiManagementGroupResource result = await apiManagementGroup.UpdateAsync(ifMatch, patch); + ServiceGroupResource result = await serviceGroup.UpdateAsync(ifMatch, groupUpdateParameters); // 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 @@ -120,7 +120,7 @@ public async Task Update_ApiManagementUpdateGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteGroup.json // this example is just showing the usage of "Group_Delete" 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 @@ -128,18 +128,18 @@ public async Task Delete_ApiManagementDeleteGroup() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGroupResource created on azure - // for more information of creating ApiManagementGroupResource, please refer to the document of ApiManagementGroupResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceGroupResource created on azure + // for more information of creating ServiceGroupResource, please refer to the document of ServiceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string groupId = "aadGroup"; - ResourceIdentifier apiManagementGroupResourceId = ApiManagementGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); - ApiManagementGroupResource apiManagementGroup = client.GetApiManagementGroupResource(apiManagementGroupResourceId); + ResourceIdentifier serviceGroupResourceId = ServiceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); + ServiceGroupResource serviceGroup = client.GetServiceGroupResource(serviceGroupResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - await apiManagementGroup.DeleteAsync(WaitUntil.Completed, ifMatch); + await serviceGroup.DeleteAsync(WaitUntil.Completed, ifMatch); Console.WriteLine($"Succeeded"); } @@ -149,7 +149,7 @@ public async Task Delete_ApiManagementDeleteGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetGroupUsers_ApiManagementListGroupUsers() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGroupUsers.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListGroupUsers.json // this example is just showing the usage of "GroupUser_List" 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 @@ -157,17 +157,17 @@ public async Task GetGroupUsers_ApiManagementListGroupUsers() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGroupResource created on azure - // for more information of creating ApiManagementGroupResource, please refer to the document of ApiManagementGroupResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceGroupResource created on azure + // for more information of creating ServiceGroupResource, please refer to the document of ServiceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string groupId = "57d2ef278aa04f0888cba3f3"; - ResourceIdentifier apiManagementGroupResourceId = ApiManagementGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); - ApiManagementGroupResource apiManagementGroup = client.GetApiManagementGroupResource(apiManagementGroupResourceId); + ResourceIdentifier serviceGroupResourceId = ServiceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); + ServiceGroupResource serviceGroup = client.GetServiceGroupResource(serviceGroupResourceId); // invoke the operation and iterate over the result - await foreach (ApiManagementGroupUserData item in apiManagementGroup.GetGroupUsersAsync()) + await foreach (ApiManagementGroupUserData item in serviceGroup.GetGroupUsersAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -180,7 +180,7 @@ public async Task GetGroupUsers_ApiManagementListGroupUsers() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckGroupUserEntityExists_ApiManagementHeadGroupUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGroupUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadGroupUser.json // this example is just showing the usage of "GroupUser_CheckEntityExists" 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 @@ -188,18 +188,18 @@ public async Task CheckGroupUserEntityExists_ApiManagementHeadGroupUser() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGroupResource created on azure - // for more information of creating ApiManagementGroupResource, please refer to the document of ApiManagementGroupResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceGroupResource created on azure + // for more information of creating ServiceGroupResource, please refer to the document of ServiceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string groupId = "59306a29e4bbd510dc24e5f9"; - ResourceIdentifier apiManagementGroupResourceId = ApiManagementGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); - ApiManagementGroupResource apiManagementGroup = client.GetApiManagementGroupResource(apiManagementGroupResourceId); + ResourceIdentifier serviceGroupResourceId = ServiceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); + ServiceGroupResource serviceGroup = client.GetServiceGroupResource(serviceGroupResourceId); // invoke the operation string userId = "5931a75ae4bbd512a88c680b"; - bool result = await apiManagementGroup.CheckGroupUserEntityExistsAsync(userId); + bool result = await serviceGroup.CheckGroupUserEntityExistsAsync(userId); Console.WriteLine($"Succeeded: {result}"); } @@ -209,7 +209,7 @@ public async Task CheckGroupUserEntityExists_ApiManagementHeadGroupUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateGroupUser_ApiManagementCreateGroupUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGroupUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGroupUser.json // this example is just showing the usage of "GroupUser_Create" 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 @@ -217,18 +217,18 @@ public async Task CreateGroupUser_ApiManagementCreateGroupUser() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGroupResource created on azure - // for more information of creating ApiManagementGroupResource, please refer to the document of ApiManagementGroupResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceGroupResource created on azure + // for more information of creating ServiceGroupResource, please refer to the document of ServiceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string groupId = "tempgroup"; - ResourceIdentifier apiManagementGroupResourceId = ApiManagementGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); - ApiManagementGroupResource apiManagementGroup = client.GetApiManagementGroupResource(apiManagementGroupResourceId); + ResourceIdentifier serviceGroupResourceId = ServiceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); + ServiceGroupResource serviceGroup = client.GetServiceGroupResource(serviceGroupResourceId); // invoke the operation string userId = "59307d350af58404d8a26300"; - ApiManagementGroupUserData result = await apiManagementGroup.CreateGroupUserAsync(userId); + ApiManagementGroupUserData result = await serviceGroup.CreateGroupUserAsync(userId); Console.WriteLine($"Succeeded: {result}"); } @@ -238,7 +238,7 @@ public async Task CreateGroupUser_ApiManagementCreateGroupUser() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteGroupUser_ApiManagementDeleteGroupUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGroupUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteGroupUser.json // this example is just showing the usage of "GroupUser_Delete" 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 @@ -246,18 +246,18 @@ public async Task DeleteGroupUser_ApiManagementDeleteGroupUser() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGroupResource created on azure - // for more information of creating ApiManagementGroupResource, please refer to the document of ApiManagementGroupResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceGroupResource created on azure + // for more information of creating ServiceGroupResource, please refer to the document of ServiceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string groupId = "templategroup"; - ResourceIdentifier apiManagementGroupResourceId = ApiManagementGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); - ApiManagementGroupResource apiManagementGroup = client.GetApiManagementGroupResource(apiManagementGroupResourceId); + ResourceIdentifier serviceGroupResourceId = ServiceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, groupId); + ServiceGroupResource serviceGroup = client.GetServiceGroupResource(serviceGroupResourceId); // invoke the operation string userId = "59307d350af58404d8a26300"; - await apiManagementGroup.DeleteGroupUserAsync(userId); + await serviceGroup.DeleteGroupUserAsync(userId); Console.WriteLine($"Succeeded"); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNamedValueCollection.cs similarity index 79% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNamedValueCollection.cs index ef74092927be..7ae030b501ae 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNamedValueCollection.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementNamedValueCollection + public partial class Sample_ServiceNamedValueCollection { // ApiManagementListNamedValues [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListNamedValues() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNamedValues.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListNamedValues.json // this example is just showing the usage of "NamedValue_ListByService" 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 @@ -33,17 +33,17 @@ public async Task GetAll_ApiManagementListNamedValues() // 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 = "subid"; + 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 ApiManagementNamedValueResource - ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + // get the collection of this ServiceNamedValueResource + ServiceNamedValueCollection collection = apiManagementService.GetServiceNamedValues(); // invoke the operation and iterate over the result - await foreach (ApiManagementNamedValueResource item in collection.GetAllAsync()) + await foreach (ServiceNamedValueResource item in collection.GetAllAsync()) { // the variable item 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 @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListNamedValues() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetNamedValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNamedValue.json // this example is just showing the usage of "NamedValue_Get" 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 @@ -70,18 +70,18 @@ public async Task Get_ApiManagementGetNamedValue() // 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 = "subid"; + 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 ApiManagementNamedValueResource - ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + // get the collection of this ServiceNamedValueResource + ServiceNamedValueCollection collection = apiManagementService.GetServiceNamedValues(); // invoke the operation string namedValueId = "testarmTemplateproperties2"; - ApiManagementNamedValueResource result = await collection.GetAsync(namedValueId); + ServiceNamedValueResource result = await collection.GetAsync(namedValueId); // 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 @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetNamedValue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetNamedValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNamedValue.json // this example is just showing the usage of "NamedValue_Get" 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 @@ -105,14 +105,14 @@ public async Task Exists_ApiManagementGetNamedValue() // 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 = "subid"; + 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 ApiManagementNamedValueResource - ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + // get the collection of this ServiceNamedValueResource + ServiceNamedValueCollection collection = apiManagementService.GetServiceNamedValues(); // invoke the operation string namedValueId = "testarmTemplateproperties2"; @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetNamedValue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetNamedValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNamedValue.json // this example is just showing the usage of "NamedValue_Get" 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 @@ -136,19 +136,19 @@ public async Task GetIfExists_ApiManagementGetNamedValue() // 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 = "subid"; + 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 ApiManagementNamedValueResource - ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + // get the collection of this ServiceNamedValueResource + ServiceNamedValueCollection collection = apiManagementService.GetServiceNamedValues(); // invoke the operation string namedValueId = "testarmTemplateproperties2"; - NullableResponse response = await collection.GetIfExistsAsync(namedValueId); - ApiManagementNamedValueResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(namedValueId); + ServiceNamedValueResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetNamedValue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetNamedValueWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValueWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNamedValueWithKeyVault.json // this example is just showing the usage of "NamedValue_Get" 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 @@ -179,18 +179,18 @@ public async Task Get_ApiManagementGetNamedValueWithKeyVault() // 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 = "subid"; + 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 ApiManagementNamedValueResource - ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + // get the collection of this ServiceNamedValueResource + ServiceNamedValueCollection collection = apiManagementService.GetServiceNamedValues(); // invoke the operation string namedValueId = "testprop6"; - ApiManagementNamedValueResource result = await collection.GetAsync(namedValueId); + ServiceNamedValueResource result = await collection.GetAsync(namedValueId); // 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 @@ -204,7 +204,7 @@ public async Task Get_ApiManagementGetNamedValueWithKeyVault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetNamedValueWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValueWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNamedValueWithKeyVault.json // this example is just showing the usage of "NamedValue_Get" 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 @@ -214,14 +214,14 @@ public async Task Exists_ApiManagementGetNamedValueWithKeyVault() // 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 = "subid"; + 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 ApiManagementNamedValueResource - ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + // get the collection of this ServiceNamedValueResource + ServiceNamedValueCollection collection = apiManagementService.GetServiceNamedValues(); // invoke the operation string namedValueId = "testprop6"; @@ -235,7 +235,7 @@ public async Task Exists_ApiManagementGetNamedValueWithKeyVault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetNamedValueWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValueWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNamedValueWithKeyVault.json // this example is just showing the usage of "NamedValue_Get" 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 @@ -245,19 +245,19 @@ public async Task GetIfExists_ApiManagementGetNamedValueWithKeyVault() // 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 = "subid"; + 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 ApiManagementNamedValueResource - ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + // get the collection of this ServiceNamedValueResource + ServiceNamedValueCollection collection = apiManagementService.GetServiceNamedValues(); // invoke the operation string namedValueId = "testprop6"; - NullableResponse response = await collection.GetIfExistsAsync(namedValueId); - ApiManagementNamedValueResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(namedValueId); + ServiceNamedValueResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -278,7 +278,7 @@ public async Task GetIfExists_ApiManagementGetNamedValueWithKeyVault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateNamedValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNamedValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateNamedValue.json // this example is just showing the usage of "NamedValue_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 @@ -288,18 +288,18 @@ public async Task CreateOrUpdate_ApiManagementCreateNamedValue() // 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 = "subid"; + 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 ApiManagementNamedValueResource - ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + // get the collection of this ServiceNamedValueResource + ServiceNamedValueCollection collection = apiManagementService.GetServiceNamedValues(); // invoke the operation string namedValueId = "testprop2"; - ApiManagementNamedValueCreateOrUpdateContent content = new ApiManagementNamedValueCreateOrUpdateContent() + NamedValueCreateContract namedValueCreateContract = new NamedValueCreateContract() { Tags = { @@ -309,8 +309,8 @@ public async Task CreateOrUpdate_ApiManagementCreateNamedValue() DisplayName = "prop3name", Value = "propValue", }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namedValueId, content); - ApiManagementNamedValueResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namedValueId, namedValueCreateContract); + ServiceNamedValueResource 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 @@ -324,7 +324,7 @@ public async Task CreateOrUpdate_ApiManagementCreateNamedValue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateNamedValueWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNamedValueWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateNamedValueWithKeyVault.json // this example is just showing the usage of "NamedValue_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 @@ -334,18 +334,18 @@ public async Task CreateOrUpdate_ApiManagementCreateNamedValueWithKeyVault() // 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 = "subid"; + 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 ApiManagementNamedValueResource - ApiManagementNamedValueCollection collection = apiManagementService.GetApiManagementNamedValues(); + // get the collection of this ServiceNamedValueResource + ServiceNamedValueCollection collection = apiManagementService.GetServiceNamedValues(); // invoke the operation string namedValueId = "testprop6"; - ApiManagementNamedValueCreateOrUpdateContent content = new ApiManagementNamedValueCreateOrUpdateContent() + NamedValueCreateContract namedValueCreateContract = new NamedValueCreateContract() { Tags = { @@ -359,8 +359,8 @@ public async Task CreateOrUpdate_ApiManagementCreateNamedValueWithKeyVault() IdentityClientId = "ceaa6b06-c00f-43ef-99ac-f53d1fe876a0", }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namedValueId, content); - ApiManagementNamedValueResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namedValueId, namedValueCreateContract); + ServiceNamedValueResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNamedValueResource.cs similarity index 60% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNamedValueResource.cs index b860b58d5a58..4788c258e3ad 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNamedValueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNamedValueResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementNamedValueResource + public partial class Sample_ServiceNamedValueResource { // ApiManagementHeadNamedValue [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadNamedValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadNamedValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadNamedValue.json // this example is just showing the usage of "NamedValue_GetEntityTag" 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 @@ -31,17 +31,17 @@ public async Task GetEntityTag_ApiManagementHeadNamedValue() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNamedValueResource created on azure - // for more information of creating ApiManagementNamedValueResource, please refer to the document of ApiManagementNamedValueResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNamedValueResource created on azure + // for more information of creating ServiceNamedValueResource, please refer to the document of ServiceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string namedValueId = "testarmTemplateproperties2"; - ResourceIdentifier apiManagementNamedValueResourceId = ApiManagementNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); - ApiManagementNamedValueResource apiManagementNamedValue = client.GetApiManagementNamedValueResource(apiManagementNamedValueResourceId); + ResourceIdentifier serviceNamedValueResourceId = ServiceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); + ServiceNamedValueResource serviceNamedValue = client.GetServiceNamedValueResource(serviceNamedValueResourceId); // invoke the operation - bool result = await apiManagementNamedValue.GetEntityTagAsync(); + bool result = await serviceNamedValue.GetEntityTagAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadNamedValue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetNamedValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNamedValue.json // this example is just showing the usage of "NamedValue_Get" 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 @@ -59,17 +59,17 @@ public async Task Get_ApiManagementGetNamedValue() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNamedValueResource created on azure - // for more information of creating ApiManagementNamedValueResource, please refer to the document of ApiManagementNamedValueResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNamedValueResource created on azure + // for more information of creating ServiceNamedValueResource, please refer to the document of ServiceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string namedValueId = "testarmTemplateproperties2"; - ResourceIdentifier apiManagementNamedValueResourceId = ApiManagementNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); - ApiManagementNamedValueResource apiManagementNamedValue = client.GetApiManagementNamedValueResource(apiManagementNamedValueResourceId); + ResourceIdentifier serviceNamedValueResourceId = ServiceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); + ServiceNamedValueResource serviceNamedValue = client.GetServiceNamedValueResource(serviceNamedValueResourceId); // invoke the operation - ApiManagementNamedValueResource result = await apiManagementNamedValue.GetAsync(); + ServiceNamedValueResource result = await serviceNamedValue.GetAsync(); // 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 @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetNamedValue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetNamedValueWithKeyVault() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNamedValueWithKeyVault.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNamedValueWithKeyVault.json // this example is just showing the usage of "NamedValue_Get" 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 @@ -91,17 +91,17 @@ public async Task Get_ApiManagementGetNamedValueWithKeyVault() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNamedValueResource created on azure - // for more information of creating ApiManagementNamedValueResource, please refer to the document of ApiManagementNamedValueResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNamedValueResource created on azure + // for more information of creating ServiceNamedValueResource, please refer to the document of ServiceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string namedValueId = "testprop6"; - ResourceIdentifier apiManagementNamedValueResourceId = ApiManagementNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); - ApiManagementNamedValueResource apiManagementNamedValue = client.GetApiManagementNamedValueResource(apiManagementNamedValueResourceId); + ResourceIdentifier serviceNamedValueResourceId = ServiceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); + ServiceNamedValueResource serviceNamedValue = client.GetServiceNamedValueResource(serviceNamedValueResourceId); // invoke the operation - ApiManagementNamedValueResource result = await apiManagementNamedValue.GetAsync(); + ServiceNamedValueResource result = await serviceNamedValue.GetAsync(); // 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 @@ -115,7 +115,7 @@ public async Task Get_ApiManagementGetNamedValueWithKeyVault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateNamedValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateNamedValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateNamedValue.json // this example is just showing the usage of "NamedValue_Update" 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 @@ -123,18 +123,18 @@ public async Task Update_ApiManagementUpdateNamedValue() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNamedValueResource created on azure - // for more information of creating ApiManagementNamedValueResource, please refer to the document of ApiManagementNamedValueResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNamedValueResource created on azure + // for more information of creating ServiceNamedValueResource, please refer to the document of ServiceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string namedValueId = "testprop2"; - ResourceIdentifier apiManagementNamedValueResourceId = ApiManagementNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); - ApiManagementNamedValueResource apiManagementNamedValue = client.GetApiManagementNamedValueResource(apiManagementNamedValueResourceId); + ResourceIdentifier serviceNamedValueResourceId = ServiceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); + ServiceNamedValueResource serviceNamedValue = client.GetServiceNamedValueResource(serviceNamedValueResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - ApiManagementNamedValuePatch patch = new ApiManagementNamedValuePatch() + NamedValueUpdateParameters namedValueUpdateParameters = new NamedValueUpdateParameters() { Tags = { @@ -144,8 +144,8 @@ public async Task Update_ApiManagementUpdateNamedValue() DisplayName = "prop3name", Value = "propValue", }; - ArmOperation lro = await apiManagementNamedValue.UpdateAsync(WaitUntil.Completed, ifMatch, patch); - ApiManagementNamedValueResource result = lro.Value; + ArmOperation lro = await serviceNamedValue.UpdateAsync(WaitUntil.Completed, ifMatch, namedValueUpdateParameters); + ServiceNamedValueResource 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 @@ -159,7 +159,7 @@ public async Task Update_ApiManagementUpdateNamedValue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteNamedValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteNamedValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteNamedValue.json // this example is just showing the usage of "NamedValue_Delete" 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 @@ -167,18 +167,18 @@ public async Task Delete_ApiManagementDeleteNamedValue() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNamedValueResource created on azure - // for more information of creating ApiManagementNamedValueResource, please refer to the document of ApiManagementNamedValueResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNamedValueResource created on azure + // for more information of creating ServiceNamedValueResource, please refer to the document of ServiceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string namedValueId = "testprop2"; - ResourceIdentifier apiManagementNamedValueResourceId = ApiManagementNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); - ApiManagementNamedValueResource apiManagementNamedValue = client.GetApiManagementNamedValueResource(apiManagementNamedValueResourceId); + ResourceIdentifier serviceNamedValueResourceId = ServiceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); + ServiceNamedValueResource serviceNamedValue = client.GetServiceNamedValueResource(serviceNamedValueResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - await apiManagementNamedValue.DeleteAsync(WaitUntil.Completed, ifMatch); + await serviceNamedValue.DeleteAsync(WaitUntil.Completed, ifMatch); Console.WriteLine($"Succeeded"); } @@ -188,7 +188,7 @@ public async Task Delete_ApiManagementDeleteNamedValue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetValue_ApiManagementNamedValueListValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementNamedValueListValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementNamedValueListValue.json // this example is just showing the usage of "NamedValue_ListValue" 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 @@ -196,17 +196,17 @@ public async Task GetValue_ApiManagementNamedValueListValue() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNamedValueResource created on azure - // for more information of creating ApiManagementNamedValueResource, please refer to the document of ApiManagementNamedValueResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNamedValueResource created on azure + // for more information of creating ServiceNamedValueResource, please refer to the document of ServiceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string namedValueId = "testarmTemplateproperties2"; - ResourceIdentifier apiManagementNamedValueResourceId = ApiManagementNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); - ApiManagementNamedValueResource apiManagementNamedValue = client.GetApiManagementNamedValueResource(apiManagementNamedValueResourceId); + ResourceIdentifier serviceNamedValueResourceId = ServiceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); + ServiceNamedValueResource serviceNamedValue = client.GetServiceNamedValueResource(serviceNamedValueResourceId); // invoke the operation - NamedValueSecretContract result = await apiManagementNamedValue.GetValueAsync(); + NamedValueSecretContract result = await serviceNamedValue.GetValueAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -216,7 +216,7 @@ public async Task GetValue_ApiManagementNamedValueListValue() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RefreshSecret_ApiManagementRefreshNamedValue() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementRefreshNamedValue.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementRefreshNamedValue.json // this example is just showing the usage of "NamedValue_RefreshSecret" 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 @@ -224,18 +224,18 @@ public async Task RefreshSecret_ApiManagementRefreshNamedValue() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNamedValueResource created on azure - // for more information of creating ApiManagementNamedValueResource, please refer to the document of ApiManagementNamedValueResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNamedValueResource created on azure + // for more information of creating ServiceNamedValueResource, please refer to the document of ServiceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string namedValueId = "testprop2"; - ResourceIdentifier apiManagementNamedValueResourceId = ApiManagementNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); - ApiManagementNamedValueResource apiManagementNamedValue = client.GetApiManagementNamedValueResource(apiManagementNamedValueResourceId); + ResourceIdentifier serviceNamedValueResourceId = ServiceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, namedValueId); + ServiceNamedValueResource serviceNamedValue = client.GetServiceNamedValueResource(serviceNamedValueResourceId); // invoke the operation - ArmOperation lro = await apiManagementNamedValue.RefreshSecretAsync(WaitUntil.Completed); - ApiManagementNamedValueResource result = lro.Value; + ArmOperation lro = await serviceNamedValue.RefreshSecretAsync(WaitUntil.Completed); + ServiceNamedValueResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNotificationCollection.cs similarity index 80% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNotificationCollection.cs index 59bf37d74163..d98b2e5dc4e7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNotificationCollection.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementNotificationCollection + public partial class Sample_ServiceNotificationCollection { // ApiManagementListNotifications [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListNotifications() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNotifications.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListNotifications.json // this example is just showing the usage of "Notification_ListByService" 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 @@ -33,17 +33,17 @@ public async Task GetAll_ApiManagementListNotifications() // 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 = "subid"; + 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 ApiManagementNotificationResource - ApiManagementNotificationCollection collection = apiManagementService.GetApiManagementNotifications(); + // get the collection of this ServiceNotificationResource + ServiceNotificationCollection collection = apiManagementService.GetServiceNotifications(); // invoke the operation and iterate over the result - await foreach (ApiManagementNotificationResource item in collection.GetAllAsync()) + await foreach (ServiceNotificationResource item in collection.GetAllAsync()) { // the variable item 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 @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListNotifications() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetNotification() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNotification.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNotification.json // this example is just showing the usage of "Notification_Get" 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 @@ -70,18 +70,18 @@ public async Task Get_ApiManagementGetNotification() // 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 = "subid"; + 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 ApiManagementNotificationResource - ApiManagementNotificationCollection collection = apiManagementService.GetApiManagementNotifications(); + // get the collection of this ServiceNotificationResource + ServiceNotificationCollection collection = apiManagementService.GetServiceNotifications(); // invoke the operation NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ApiManagementNotificationResource result = await collection.GetAsync(notificationName); + ServiceNotificationResource result = await collection.GetAsync(notificationName); // 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 @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetNotification() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetNotification() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNotification.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNotification.json // this example is just showing the usage of "Notification_Get" 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 @@ -105,14 +105,14 @@ public async Task Exists_ApiManagementGetNotification() // 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 = "subid"; + 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 ApiManagementNotificationResource - ApiManagementNotificationCollection collection = apiManagementService.GetApiManagementNotifications(); + // get the collection of this ServiceNotificationResource + ServiceNotificationCollection collection = apiManagementService.GetServiceNotifications(); // invoke the operation NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetNotification() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetNotification() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNotification.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNotification.json // this example is just showing the usage of "Notification_Get" 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 @@ -136,19 +136,19 @@ public async Task GetIfExists_ApiManagementGetNotification() // 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 = "subid"; + 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 ApiManagementNotificationResource - ApiManagementNotificationCollection collection = apiManagementService.GetApiManagementNotifications(); + // get the collection of this ServiceNotificationResource + ServiceNotificationCollection collection = apiManagementService.GetServiceNotifications(); // invoke the operation NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - NullableResponse response = await collection.GetIfExistsAsync(notificationName); - ApiManagementNotificationResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(notificationName); + ServiceNotificationResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetNotification() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateNotification() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotification.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateNotification.json // this example is just showing the usage of "Notification_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 @@ -179,19 +179,19 @@ public async Task CreateOrUpdate_ApiManagementCreateNotification() // 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 = "subid"; + 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 ApiManagementNotificationResource - ApiManagementNotificationCollection collection = apiManagementService.GetApiManagementNotifications(); + // get the collection of this ServiceNotificationResource + ServiceNotificationCollection collection = apiManagementService.GetServiceNotifications(); // invoke the operation NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, notificationName); - ApiManagementNotificationResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, notificationName); + ServiceNotificationResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNotificationResource.cs similarity index 59% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNotificationResource.cs index bac8353422a4..b840b1ce90c6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementNotificationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceNotificationResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementNotificationResource + public partial class Sample_ServiceNotificationResource { // ApiManagementGetNotification [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetNotification() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetNotification.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetNotification.json // this example is just showing the usage of "Notification_Get" 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 @@ -31,17 +31,17 @@ public async Task Get_ApiManagementGetNotification() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation - ApiManagementNotificationResource result = await apiManagementNotification.GetAsync(); + ServiceNotificationResource result = await serviceNotification.GetAsync(); // 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 @@ -55,7 +55,7 @@ public async Task Get_ApiManagementGetNotification() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateNotification() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotification.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateNotification.json // this example is just showing the usage of "Notification_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 @@ -63,18 +63,18 @@ public async Task Update_ApiManagementCreateNotification() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation - ArmOperation lro = await apiManagementNotification.UpdateAsync(WaitUntil.Completed); - ApiManagementNotificationResource result = lro.Value; + ArmOperation lro = await serviceNotification.UpdateAsync(WaitUntil.Completed); + ServiceNotificationResource 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 @@ -88,7 +88,7 @@ public async Task Update_ApiManagementCreateNotification() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNotificationRecipientUsers_ApiManagementListNotificationRecipientUsers() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNotificationRecipientUsers.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListNotificationRecipientUsers.json // this example is just showing the usage of "NotificationRecipientUser_ListByNotification" 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 @@ -96,17 +96,17 @@ public async Task GetNotificationRecipientUsers_ApiManagementListNotificationRec // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation and iterate over the result - await foreach (RecipientUserContract item in apiManagementNotification.GetNotificationRecipientUsersAsync()) + await foreach (RecipientUserContract item in serviceNotification.GetNotificationRecipientUsersAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -119,7 +119,7 @@ public async Task GetNotificationRecipientUsers_ApiManagementListNotificationRec [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckNotificationRecipientUserEntityExists_ApiManagementHeadNotificationRecipientUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadNotificationRecipientUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadNotificationRecipientUser.json // this example is just showing the usage of "NotificationRecipientUser_CheckEntityExists" 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 @@ -127,18 +127,18 @@ public async Task CheckNotificationRecipientUserEntityExists_ApiManagementHeadNo // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation string userId = "576823d0a40f7e74ec07d642"; - bool result = await apiManagementNotification.CheckNotificationRecipientUserEntityExistsAsync(userId); + bool result = await serviceNotification.CheckNotificationRecipientUserEntityExistsAsync(userId); Console.WriteLine($"Succeeded: {result}"); } @@ -148,7 +148,7 @@ public async Task CheckNotificationRecipientUserEntityExists_ApiManagementHeadNo [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateNotificationRecipientUser_ApiManagementCreateNotificationRecipientUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotificationRecipientUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateNotificationRecipientUser.json // this example is just showing the usage of "NotificationRecipientUser_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 @@ -156,18 +156,18 @@ public async Task CreateOrUpdateNotificationRecipientUser_ApiManagementCreateNot // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation string userId = "576823d0a40f7e74ec07d642"; - RecipientUserContract result = await apiManagementNotification.CreateOrUpdateNotificationRecipientUserAsync(userId); + RecipientUserContract result = await serviceNotification.CreateOrUpdateNotificationRecipientUserAsync(userId); Console.WriteLine($"Succeeded: {result}"); } @@ -177,7 +177,7 @@ public async Task CreateOrUpdateNotificationRecipientUser_ApiManagementCreateNot [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteNotificationRecipientUser_ApiManagementDeleteNotificationRecipientUser() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteNotificationRecipientUser.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteNotificationRecipientUser.json // this example is just showing the usage of "NotificationRecipientUser_Delete" 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 @@ -185,18 +185,18 @@ public async Task DeleteNotificationRecipientUser_ApiManagementDeleteNotificatio // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation string userId = "576823d0a40f7e74ec07d642"; - await apiManagementNotification.DeleteNotificationRecipientUserAsync(userId); + await serviceNotification.DeleteNotificationRecipientUserAsync(userId); Console.WriteLine($"Succeeded"); } @@ -206,7 +206,7 @@ public async Task DeleteNotificationRecipientUser_ApiManagementDeleteNotificatio [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNotificationRecipientEmails_ApiManagementListNotificationRecipientEmails() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListNotificationRecipientEmails.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListNotificationRecipientEmails.json // this example is just showing the usage of "NotificationRecipientEmail_ListByNotification" 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 @@ -214,17 +214,17 @@ public async Task GetNotificationRecipientEmails_ApiManagementListNotificationRe // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation and iterate over the result - await foreach (RecipientEmailContract item in apiManagementNotification.GetNotificationRecipientEmailsAsync()) + await foreach (RecipientEmailContract item in serviceNotification.GetNotificationRecipientEmailsAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -237,7 +237,7 @@ public async Task GetNotificationRecipientEmails_ApiManagementListNotificationRe [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckNotificationRecipientEmailEntityExists_ApiManagementHeadNotificationRecipientEmail() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadNotificationRecipientEmail.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadNotificationRecipientEmail.json // this example is just showing the usage of "NotificationRecipientEmail_CheckEntityExists" 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 @@ -245,18 +245,18 @@ public async Task CheckNotificationRecipientEmailEntityExists_ApiManagementHeadN // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation string email = "contoso@live.com"; - bool result = await apiManagementNotification.CheckNotificationRecipientEmailEntityExistsAsync(email); + bool result = await serviceNotification.CheckNotificationRecipientEmailEntityExistsAsync(email); Console.WriteLine($"Succeeded: {result}"); } @@ -266,7 +266,7 @@ public async Task CheckNotificationRecipientEmailEntityExists_ApiManagementHeadN [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateNotificationRecipientEmail_ApiManagementCreateNotificationRecipientEmail() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateNotificationRecipientEmail.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateNotificationRecipientEmail.json // this example is just showing the usage of "NotificationRecipientEmail_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 @@ -274,18 +274,18 @@ public async Task CreateOrUpdateNotificationRecipientEmail_ApiManagementCreateNo // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation string email = "foobar@live.com"; - RecipientEmailContract result = await apiManagementNotification.CreateOrUpdateNotificationRecipientEmailAsync(email); + RecipientEmailContract result = await serviceNotification.CreateOrUpdateNotificationRecipientEmailAsync(email); Console.WriteLine($"Succeeded: {result}"); } @@ -295,7 +295,7 @@ public async Task CreateOrUpdateNotificationRecipientEmail_ApiManagementCreateNo [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteNotificationRecipientEmail_ApiManagementDeleteNotificationRecipientEmail() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteNotificationRecipientEmail.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteNotificationRecipientEmail.json // this example is just showing the usage of "NotificationRecipientEmail_Delete" 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 @@ -303,18 +303,18 @@ public async Task DeleteNotificationRecipientEmail_ApiManagementDeleteNotificati // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementNotificationResource created on azure - // for more information of creating ApiManagementNotificationResource, please refer to the document of ApiManagementNotificationResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceNotificationResource created on azure + // for more information of creating ServiceNotificationResource, please refer to the document of ServiceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; - ResourceIdentifier apiManagementNotificationResourceId = ApiManagementNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); - ApiManagementNotificationResource apiManagementNotification = client.GetApiManagementNotificationResource(apiManagementNotificationResourceId); + ResourceIdentifier serviceNotificationResourceId = ServiceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, notificationName); + ServiceNotificationResource serviceNotification = client.GetServiceNotificationResource(serviceNotificationResourceId); // invoke the operation string email = "contoso@live.com"; - await apiManagementNotification.DeleteNotificationRecipientEmailAsync(email); + await serviceNotification.DeleteNotificationRecipientEmailAsync(email); Console.WriteLine($"Succeeded"); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServicePolicyFragmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServicePolicyFragmentCollection.cs new file mode 100644 index 000000000000..f49d4c7c8418 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServicePolicyFragmentCollection.cs @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServicePolicyFragmentCollection + { + // ApiManagementListPolicyFragments + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListPolicyFragments() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPolicyFragments.json + // this example is just showing the usage of "PolicyFragment_ListByService" 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 ServicePolicyFragmentResource + ServicePolicyFragmentCollection collection = apiManagementService.GetServicePolicyFragments(); + + // invoke the operation and iterate over the result + await foreach (ServicePolicyFragmentResource item in collection.GetAllAsync()) + { + // the variable item 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 + PolicyFragmentContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetPolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetPolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFragment.json + // this example is just showing the usage of "PolicyFragment_Get" 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 ServicePolicyFragmentResource + ServicePolicyFragmentCollection collection = apiManagementService.GetServicePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + ServicePolicyFragmentResource result = await collection.GetAsync(id); + + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetPolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetPolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFragment.json + // this example is just showing the usage of "PolicyFragment_Get" 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 ServicePolicyFragmentResource + ServicePolicyFragmentCollection collection = apiManagementService.GetServicePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + bool result = await collection.ExistsAsync(id); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetPolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetPolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFragment.json + // this example is just showing the usage of "PolicyFragment_Get" 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 ServicePolicyFragmentResource + ServicePolicyFragmentCollection collection = apiManagementService.GetServicePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + NullableResponse response = await collection.GetIfExistsAsync(id); + ServicePolicyFragmentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementGetPolicyFragmentFormat + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetPolicyFragmentFormat() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFragmentFormat.json + // this example is just showing the usage of "PolicyFragment_Get" 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 ServicePolicyFragmentResource + ServicePolicyFragmentCollection collection = apiManagementService.GetServicePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + PolicyFragmentContentFormat? format = PolicyFragmentContentFormat.Rawxml; + ServicePolicyFragmentResource result = await collection.GetAsync(id, format: format); + + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetPolicyFragmentFormat + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetPolicyFragmentFormat() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFragmentFormat.json + // this example is just showing the usage of "PolicyFragment_Get" 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 ServicePolicyFragmentResource + ServicePolicyFragmentCollection collection = apiManagementService.GetServicePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + PolicyFragmentContentFormat? format = PolicyFragmentContentFormat.Rawxml; + bool result = await collection.ExistsAsync(id, format: format); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetPolicyFragmentFormat + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetPolicyFragmentFormat() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFragmentFormat.json + // this example is just showing the usage of "PolicyFragment_Get" 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 ServicePolicyFragmentResource + ServicePolicyFragmentCollection collection = apiManagementService.GetServicePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + PolicyFragmentContentFormat? format = PolicyFragmentContentFormat.Rawxml; + NullableResponse response = await collection.GetIfExistsAsync(id, format: format); + ServicePolicyFragmentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreatePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreatePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreatePolicyFragment.json + // this example is just showing the usage of "PolicyFragment_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 ServicePolicyFragmentResource + ServicePolicyFragmentCollection collection = apiManagementService.GetServicePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + PolicyFragmentContractData data = new PolicyFragmentContractData() + { + Value = "", + Description = "A policy fragment example", + Format = PolicyFragmentContentFormat.Xml, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, id, data); + ServicePolicyFragmentResource 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServicePolicyFragmentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServicePolicyFragmentResource.cs new file mode 100644 index 000000000000..beeb76dcc407 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServicePolicyFragmentResource.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServicePolicyFragmentResource + { + // ApiManagementHeadPolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadPolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadPolicyFragment.json + // this example is just showing the usage of "PolicyFragment_GetEntityTag" 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 ServicePolicyFragmentResource created on azure + // for more information of creating ServicePolicyFragmentResource, please refer to the document of ServicePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string id = "policyFragment1"; + ResourceIdentifier servicePolicyFragmentResourceId = ServicePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, id); + ServicePolicyFragmentResource servicePolicyFragment = client.GetServicePolicyFragmentResource(servicePolicyFragmentResourceId); + + // invoke the operation + bool result = await servicePolicyFragment.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetPolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetPolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFragment.json + // this example is just showing the usage of "PolicyFragment_Get" 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 ServicePolicyFragmentResource created on azure + // for more information of creating ServicePolicyFragmentResource, please refer to the document of ServicePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string id = "policyFragment1"; + ResourceIdentifier servicePolicyFragmentResourceId = ServicePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, id); + ServicePolicyFragmentResource servicePolicyFragment = client.GetServicePolicyFragmentResource(servicePolicyFragmentResourceId); + + // invoke the operation + ServicePolicyFragmentResource result = await servicePolicyFragment.GetAsync(); + + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetPolicyFragmentFormat + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetPolicyFragmentFormat() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetPolicyFragmentFormat.json + // this example is just showing the usage of "PolicyFragment_Get" 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 ServicePolicyFragmentResource created on azure + // for more information of creating ServicePolicyFragmentResource, please refer to the document of ServicePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string id = "policyFragment1"; + ResourceIdentifier servicePolicyFragmentResourceId = ServicePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, id); + ServicePolicyFragmentResource servicePolicyFragment = client.GetServicePolicyFragmentResource(servicePolicyFragmentResourceId); + + // invoke the operation + PolicyFragmentContentFormat? format = PolicyFragmentContentFormat.Rawxml; + ServicePolicyFragmentResource result = await servicePolicyFragment.GetAsync(format: format); + + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreatePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreatePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreatePolicyFragment.json + // this example is just showing the usage of "PolicyFragment_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 ServicePolicyFragmentResource created on azure + // for more information of creating ServicePolicyFragmentResource, please refer to the document of ServicePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string id = "policyFragment1"; + ResourceIdentifier servicePolicyFragmentResourceId = ServicePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, id); + ServicePolicyFragmentResource servicePolicyFragment = client.GetServicePolicyFragmentResource(servicePolicyFragmentResourceId); + + // invoke the operation + PolicyFragmentContractData data = new PolicyFragmentContractData() + { + Value = "", + Description = "A policy fragment example", + Format = PolicyFragmentContentFormat.Xml, + }; + ArmOperation lro = await servicePolicyFragment.UpdateAsync(WaitUntil.Completed, data); + ServicePolicyFragmentResource 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeletePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeletePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeletePolicyFragment.json + // this example is just showing the usage of "PolicyFragment_Delete" 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 ServicePolicyFragmentResource created on azure + // for more information of creating ServicePolicyFragmentResource, please refer to the document of ServicePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string id = "policyFragment1"; + ResourceIdentifier servicePolicyFragmentResourceId = ServicePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, id); + ServicePolicyFragmentResource servicePolicyFragment = client.GetServicePolicyFragmentResource(servicePolicyFragmentResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await servicePolicyFragment.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementListPolicyFragmentReferences + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetReferences_ApiManagementListPolicyFragmentReferences() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListPolicyFragmentReferences.json + // this example is just showing the usage of "PolicyFragment_ListReferences" 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 ServicePolicyFragmentResource created on azure + // for more information of creating ServicePolicyFragmentResource, please refer to the document of ServicePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string id = "policyFragment1"; + ResourceIdentifier servicePolicyFragmentResourceId = ServicePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, id); + ServicePolicyFragmentResource servicePolicyFragment = client.GetServicePolicyFragmentResource(servicePolicyFragmentResourceId); + + // invoke the operation and iterate over the result + await foreach (ResourceCollectionValueItem item in servicePolicyFragment.GetReferencesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductApiLinkCollection.cs new file mode 100644 index 000000000000..65aa3aab6f55 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductApiLinkCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceProductApiLinkCollection + { + // ApiManagementListProductApiLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListProductApiLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListProductApiLinks.json + // this example is just showing the usage of "ProductApiLink_ListByProduct" 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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "product1"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductApiLinkResource + ServiceProductApiLinkCollection collection = serviceProduct.GetServiceProductApiLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceProductApiLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + ProductApiLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductApiLink.json + // this example is just showing the usage of "ProductApiLink_Get" 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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductApiLinkResource + ServiceProductApiLinkCollection collection = serviceProduct.GetServiceProductApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + ServiceProductApiLinkResource result = await collection.GetAsync(apiLinkId); + + // 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductApiLink.json + // this example is just showing the usage of "ProductApiLink_Get" 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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductApiLinkResource + ServiceProductApiLinkCollection collection = serviceProduct.GetServiceProductApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + bool result = await collection.ExistsAsync(apiLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductApiLink.json + // this example is just showing the usage of "ProductApiLink_Get" 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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductApiLinkResource + ServiceProductApiLinkCollection collection = serviceProduct.GetServiceProductApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(apiLinkId); + ServiceProductApiLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductApiLink.json + // this example is just showing the usage of "ProductApiLink_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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductApiLinkResource + ServiceProductApiLinkCollection collection = serviceProduct.GetServiceProductApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + ProductApiLinkContractData data = new ProductApiLinkContractData() + { + ApiId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiLinkId, data); + ServiceProductApiLinkResource 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductApiLinkResource.cs new file mode 100644 index 000000000000..51e6dca9c680 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductApiLinkResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceProductApiLinkResource + { + // ApiManagementGetProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductApiLink.json + // this example is just showing the usage of "ProductApiLink_Get" 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 ServiceProductApiLinkResource created on azure + // for more information of creating ServiceProductApiLinkResource, please refer to the document of ServiceProductApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + string apiLinkId = "link1"; + ResourceIdentifier serviceProductApiLinkResourceId = ServiceProductApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + ServiceProductApiLinkResource serviceProductApiLink = client.GetServiceProductApiLinkResource(serviceProductApiLinkResourceId); + + // invoke the operation + ServiceProductApiLinkResource result = await serviceProductApiLink.GetAsync(); + + // 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductApiLink.json + // this example is just showing the usage of "ProductApiLink_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 ServiceProductApiLinkResource created on azure + // for more information of creating ServiceProductApiLinkResource, please refer to the document of ServiceProductApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + string apiLinkId = "link1"; + ResourceIdentifier serviceProductApiLinkResourceId = ServiceProductApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + ServiceProductApiLinkResource serviceProductApiLink = client.GetServiceProductApiLinkResource(serviceProductApiLinkResourceId); + + // invoke the operation + ProductApiLinkContractData data = new ProductApiLinkContractData() + { + ApiId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api", + }; + ArmOperation lro = await serviceProductApiLink.UpdateAsync(WaitUntil.Completed, data); + ServiceProductApiLinkResource 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteProductApiLink.json + // this example is just showing the usage of "ProductApiLink_Delete" 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 ServiceProductApiLinkResource created on azure + // for more information of creating ServiceProductApiLinkResource, please refer to the document of ServiceProductApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + string apiLinkId = "link1"; + ResourceIdentifier serviceProductApiLinkResourceId = ServiceProductApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + ServiceProductApiLinkResource serviceProductApiLink = client.GetServiceProductApiLinkResource(serviceProductApiLinkResourceId); + + // invoke the operation + await serviceProductApiLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductCollection.cs similarity index 80% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductCollection.cs index 0df12fb9abbe..812e35d64c6b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductCollection.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementProductCollection + public partial class Sample_ServiceProductCollection { // ApiManagementListProducts [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListProducts() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProducts.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListProducts.json // this example is just showing the usage of "Product_ListByService" 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 @@ -32,17 +32,17 @@ public async Task GetAll_ApiManagementListProducts() // 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 = "subid"; + 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 ApiManagementProductResource - ApiManagementProductCollection collection = apiManagementService.GetApiManagementProducts(); + // get the collection of this ServiceProductResource + ServiceProductCollection collection = apiManagementService.GetServiceProducts(); // invoke the operation and iterate over the result - await foreach (ApiManagementProductResource item in collection.GetAllAsync()) + await foreach (ServiceProductResource item in collection.GetAllAsync()) { // the variable item 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 @@ -59,7 +59,7 @@ public async Task GetAll_ApiManagementListProducts() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetProduct() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProduct.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProduct.json // this example is just showing the usage of "Product_Get" 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 @@ -69,18 +69,18 @@ public async Task Get_ApiManagementGetProduct() // 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 = "subid"; + 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 ApiManagementProductResource - ApiManagementProductCollection collection = apiManagementService.GetApiManagementProducts(); + // get the collection of this ServiceProductResource + ServiceProductCollection collection = apiManagementService.GetServiceProducts(); // invoke the operation string productId = "unlimited"; - ApiManagementProductResource result = await collection.GetAsync(productId); + ServiceProductResource result = await collection.GetAsync(productId); // 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 @@ -94,7 +94,7 @@ public async Task Get_ApiManagementGetProduct() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetProduct() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProduct.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProduct.json // this example is just showing the usage of "Product_Get" 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 @@ -104,14 +104,14 @@ public async Task Exists_ApiManagementGetProduct() // 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 = "subid"; + 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 ApiManagementProductResource - ApiManagementProductCollection collection = apiManagementService.GetApiManagementProducts(); + // get the collection of this ServiceProductResource + ServiceProductCollection collection = apiManagementService.GetServiceProducts(); // invoke the operation string productId = "unlimited"; @@ -125,7 +125,7 @@ public async Task Exists_ApiManagementGetProduct() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetProduct() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProduct.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProduct.json // this example is just showing the usage of "Product_Get" 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 @@ -135,19 +135,19 @@ public async Task GetIfExists_ApiManagementGetProduct() // 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 = "subid"; + 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 ApiManagementProductResource - ApiManagementProductCollection collection = apiManagementService.GetApiManagementProducts(); + // get the collection of this ServiceProductResource + ServiceProductCollection collection = apiManagementService.GetServiceProducts(); // invoke the operation string productId = "unlimited"; - NullableResponse response = await collection.GetIfExistsAsync(productId); - ApiManagementProductResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(productId); + ServiceProductResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -168,7 +168,7 @@ public async Task GetIfExists_ApiManagementGetProduct() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateProduct() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProduct.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProduct.json // this example is just showing the usage of "Product_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 @@ -178,14 +178,14 @@ public async Task CreateOrUpdate_ApiManagementCreateProduct() // 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 = "subid"; + 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 ApiManagementProductResource - ApiManagementProductCollection collection = apiManagementService.GetApiManagementProducts(); + // get the collection of this ServiceProductResource + ServiceProductCollection collection = apiManagementService.GetServiceProducts(); // invoke the operation string productId = "testproduct"; @@ -193,8 +193,8 @@ public async Task CreateOrUpdate_ApiManagementCreateProduct() { DisplayName = "Test Template ProductName 4", }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, productId, data); - ApiManagementProductResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, productId, data); + ServiceProductResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductGroupLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductGroupLinkCollection.cs new file mode 100644 index 000000000000..06e80a3ee865 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductGroupLinkCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceProductGroupLinkCollection + { + // ApiManagementListProductGroupLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListProductGroupLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListProductGroupLinks.json + // this example is just showing the usage of "ProductGroupLink_ListByProduct" 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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "product1"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductGroupLinkResource + ServiceProductGroupLinkCollection collection = serviceProduct.GetServiceProductGroupLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceProductGroupLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + ProductGroupLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductGroupLink.json + // this example is just showing the usage of "ProductGroupLink_Get" 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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductGroupLinkResource + ServiceProductGroupLinkCollection collection = serviceProduct.GetServiceProductGroupLinks(); + + // invoke the operation + string groupLinkId = "link1"; + ServiceProductGroupLinkResource result = await collection.GetAsync(groupLinkId); + + // 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductGroupLink.json + // this example is just showing the usage of "ProductGroupLink_Get" 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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductGroupLinkResource + ServiceProductGroupLinkCollection collection = serviceProduct.GetServiceProductGroupLinks(); + + // invoke the operation + string groupLinkId = "link1"; + bool result = await collection.ExistsAsync(groupLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductGroupLink.json + // this example is just showing the usage of "ProductGroupLink_Get" 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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductGroupLinkResource + ServiceProductGroupLinkCollection collection = serviceProduct.GetServiceProductGroupLinks(); + + // invoke the operation + string groupLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(groupLinkId); + ServiceProductGroupLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductGroupLink.json + // this example is just showing the usage of "ProductGroupLink_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 ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); + + // get the collection of this ServiceProductGroupLinkResource + ServiceProductGroupLinkCollection collection = serviceProduct.GetServiceProductGroupLinks(); + + // invoke the operation + string groupLinkId = "link1"; + ProductGroupLinkContractData data = new ProductGroupLinkContractData() + { + GroupId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/group1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, groupLinkId, data); + ServiceProductGroupLinkResource 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductGroupLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductGroupLinkResource.cs new file mode 100644 index 000000000000..589f0a043a30 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductGroupLinkResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceProductGroupLinkResource + { + // ApiManagementGetProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductGroupLink.json + // this example is just showing the usage of "ProductGroupLink_Get" 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 ServiceProductGroupLinkResource created on azure + // for more information of creating ServiceProductGroupLinkResource, please refer to the document of ServiceProductGroupLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + string groupLinkId = "link1"; + ResourceIdentifier serviceProductGroupLinkResourceId = ServiceProductGroupLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + ServiceProductGroupLinkResource serviceProductGroupLink = client.GetServiceProductGroupLinkResource(serviceProductGroupLinkResourceId); + + // invoke the operation + ServiceProductGroupLinkResource result = await serviceProductGroupLink.GetAsync(); + + // 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductGroupLink.json + // this example is just showing the usage of "ProductGroupLink_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 ServiceProductGroupLinkResource created on azure + // for more information of creating ServiceProductGroupLinkResource, please refer to the document of ServiceProductGroupLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + string groupLinkId = "link1"; + ResourceIdentifier serviceProductGroupLinkResourceId = ServiceProductGroupLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + ServiceProductGroupLinkResource serviceProductGroupLink = client.GetServiceProductGroupLinkResource(serviceProductGroupLinkResourceId); + + // invoke the operation + ProductGroupLinkContractData data = new ProductGroupLinkContractData() + { + GroupId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/group1", + }; + ArmOperation lro = await serviceProductGroupLink.UpdateAsync(WaitUntil.Completed, data); + ServiceProductGroupLinkResource 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteProductGroupLink.json + // this example is just showing the usage of "ProductGroupLink_Delete" 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 ServiceProductGroupLinkResource created on azure + // for more information of creating ServiceProductGroupLinkResource, please refer to the document of ServiceProductGroupLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "testproduct"; + string groupLinkId = "link1"; + ResourceIdentifier serviceProductGroupLinkResourceId = ServiceProductGroupLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + ServiceProductGroupLinkResource serviceProductGroupLink = client.GetServiceProductGroupLinkResource(serviceProductGroupLinkResourceId); + + // invoke the operation + await serviceProductGroupLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductResource.cs similarity index 59% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductResource.cs index ddcc0c7e46b1..8c862fb22dce 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementProductResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementProductResource + public partial class Sample_ServiceProductResource { // ApiManagementHeadProduct [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadProduct() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProduct.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadProduct.json // this example is just showing the usage of "Product_GetEntityTag" 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 @@ -31,17 +31,17 @@ public async Task GetEntityTag_ApiManagementHeadProduct() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "unlimited"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation - bool result = await apiManagementProduct.GetEntityTagAsync(); + bool result = await serviceProduct.GetEntityTagAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadProduct() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetProduct() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetProduct.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProduct.json // this example is just showing the usage of "Product_Get" 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 @@ -59,17 +59,17 @@ public async Task Get_ApiManagementGetProduct() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "unlimited"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation - ApiManagementProductResource result = await apiManagementProduct.GetAsync(); + ServiceProductResource result = await serviceProduct.GetAsync(); // 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 @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetProduct() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateProduct() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateProduct.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateProduct.json // this example is just showing the usage of "Product_Update" 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 @@ -91,22 +91,22 @@ public async Task Update_ApiManagementUpdateProduct() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "testproduct"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - ApiManagementProductPatch patch = new ApiManagementProductPatch() + ProductUpdateParameters productUpdateParameters = new ProductUpdateParameters() { DisplayName = "Test Template ProductName 4", }; - ApiManagementProductResource result = await apiManagementProduct.UpdateAsync(ifMatch, patch); + ServiceProductResource result = await serviceProduct.UpdateAsync(ifMatch, productUpdateParameters); // 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 @@ -120,7 +120,7 @@ public async Task Update_ApiManagementUpdateProduct() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteProduct() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProduct.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteProduct.json // this example is just showing the usage of "Product_Delete" 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 @@ -128,19 +128,19 @@ public async Task Delete_ApiManagementDeleteProduct() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "testproduct"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation ETag ifMatch = new ETag("*"); bool? deleteSubscriptions = true; - await apiManagementProduct.DeleteAsync(WaitUntil.Completed, ifMatch, deleteSubscriptions: deleteSubscriptions); + await serviceProduct.DeleteAsync(WaitUntil.Completed, ifMatch, deleteSubscriptions: deleteSubscriptions); Console.WriteLine($"Succeeded"); } @@ -150,7 +150,7 @@ public async Task Delete_ApiManagementDeleteProduct() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetProductApis_ApiManagementListProductApis() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductApis.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListProductApis.json // this example is just showing the usage of "ProductApi_ListByProduct" 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 @@ -158,17 +158,17 @@ public async Task GetProductApis_ApiManagementListProductApis() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "5768181ea40f7eb6c49f6ac7"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation and iterate over the result - await foreach (ProductApiData item in apiManagementProduct.GetProductApisAsync()) + await foreach (ProductApiData item in serviceProduct.GetProductApisAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -181,7 +181,7 @@ public async Task GetProductApis_ApiManagementListProductApis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckProductApiEntityExists_ApiManagementHeadProductApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadProductApi.json // this example is just showing the usage of "ProductApi_CheckEntityExists" 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 @@ -189,18 +189,18 @@ public async Task CheckProductApiEntityExists_ApiManagementHeadProductApi() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "5931a75ae4bbd512a88c680b"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation string apiId = "59306a29e4bbd510dc24e5f9"; - bool result = await apiManagementProduct.CheckProductApiEntityExistsAsync(apiId); + bool result = await serviceProduct.CheckProductApiEntityExistsAsync(apiId); Console.WriteLine($"Succeeded: {result}"); } @@ -210,7 +210,7 @@ public async Task CheckProductApiEntityExists_ApiManagementHeadProductApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateProductApi_ApiManagementCreateProductApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductApi.json // this example is just showing the usage of "ProductApi_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 @@ -218,18 +218,18 @@ public async Task CreateOrUpdateProductApi_ApiManagementCreateProductApi() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "testproduct"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation string apiId = "echo-api"; - ProductApiData result = await apiManagementProduct.CreateOrUpdateProductApiAsync(apiId); + ProductApiData result = await serviceProduct.CreateOrUpdateProductApiAsync(apiId); Console.WriteLine($"Succeeded: {result}"); } @@ -239,7 +239,7 @@ public async Task CreateOrUpdateProductApi_ApiManagementCreateProductApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteProductApi_ApiManagementDeleteProductApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductApi.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteProductApi.json // this example is just showing the usage of "ProductApi_Delete" 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 @@ -247,18 +247,18 @@ public async Task DeleteProductApi_ApiManagementDeleteProductApi() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "testproduct"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation string apiId = "echo-api"; - await apiManagementProduct.DeleteProductApiAsync(apiId); + await serviceProduct.DeleteProductApiAsync(apiId); Console.WriteLine($"Succeeded"); } @@ -268,7 +268,7 @@ public async Task DeleteProductApi_ApiManagementDeleteProductApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetProductGroups_ApiManagementListProductGroups() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductGroups.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListProductGroups.json // this example is just showing the usage of "ProductGroup_ListByProduct" 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 @@ -276,17 +276,17 @@ public async Task GetProductGroups_ApiManagementListProductGroups() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "5600b57e7e8880006a060002"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation and iterate over the result - await foreach (ProductGroupData item in apiManagementProduct.GetProductGroupsAsync()) + await foreach (ProductGroupData item in serviceProduct.GetProductGroupsAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -299,7 +299,7 @@ public async Task GetProductGroups_ApiManagementListProductGroups() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckProductGroupEntityExists_ApiManagementHeadProductGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadProductGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadProductGroup.json // this example is just showing the usage of "ProductGroup_CheckEntityExists" 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 @@ -307,18 +307,18 @@ public async Task CheckProductGroupEntityExists_ApiManagementHeadProductGroup() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "5931a75ae4bbd512a88c680b"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation string groupId = "59306a29e4bbd510dc24e5f9"; - bool result = await apiManagementProduct.CheckProductGroupEntityExistsAsync(groupId); + bool result = await serviceProduct.CheckProductGroupEntityExistsAsync(groupId); Console.WriteLine($"Succeeded: {result}"); } @@ -328,7 +328,7 @@ public async Task CheckProductGroupEntityExists_ApiManagementHeadProductGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateProductGroup_ApiManagementCreateProductGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateProductGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductGroup.json // this example is just showing the usage of "ProductGroup_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 @@ -336,18 +336,18 @@ public async Task CreateOrUpdateProductGroup_ApiManagementCreateProductGroup() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "testproduct"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation string groupId = "templateGroup"; - ProductGroupData result = await apiManagementProduct.CreateOrUpdateProductGroupAsync(groupId); + ProductGroupData result = await serviceProduct.CreateOrUpdateProductGroupAsync(groupId); Console.WriteLine($"Succeeded: {result}"); } @@ -357,7 +357,7 @@ public async Task CreateOrUpdateProductGroup_ApiManagementCreateProductGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteProductGroup_ApiManagementDeleteProductGroup() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteProductGroup.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteProductGroup.json // this example is just showing the usage of "ProductGroup_Delete" 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 @@ -365,18 +365,18 @@ public async Task DeleteProductGroup_ApiManagementDeleteProductGroup() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "testproduct"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation string groupId = "templateGroup"; - await apiManagementProduct.DeleteProductGroupAsync(groupId); + await serviceProduct.DeleteProductGroupAsync(groupId); Console.WriteLine($"Succeeded"); } @@ -386,7 +386,7 @@ public async Task DeleteProductGroup_ApiManagementDeleteProductGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAllProductSubscriptionData_ApiManagementListProductSubscriptions() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListProductSubscriptions.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListProductSubscriptions.json // this example is just showing the usage of "ProductSubscriptions_List" 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 @@ -394,17 +394,17 @@ public async Task GetAllProductSubscriptionData_ApiManagementListProductSubscrip // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementProductResource created on azure - // for more information of creating ApiManagementProductResource, please refer to the document of ApiManagementProductResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceProductResource created on azure + // for more information of creating ServiceProductResource, please refer to the document of ServiceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string productId = "5600b57e7e8880006a060002"; - ResourceIdentifier apiManagementProductResourceId = ApiManagementProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); - ApiManagementProductResource apiManagementProduct = client.GetApiManagementProductResource(apiManagementProductResourceId); + ResourceIdentifier serviceProductResourceId = ServiceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductResource serviceProduct = client.GetServiceProductResource(serviceProductResourceId); // invoke the operation and iterate over the result - await foreach (SubscriptionContractData item in apiManagementProduct.GetAllProductSubscriptionDataAsync()) + await foreach (SubscriptionContractData item in serviceProduct.GetAllProductSubscriptionDataAsync()) { // for demo we just print out the id Console.WriteLine($"Succeeded on id: {item.Id}"); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductWikiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductWikiResource.cs new file mode 100644 index 000000000000..97bf790a4ee2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceProductWikiResource.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceProductWikiResource + { + // ApiManagementHeadProductWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadProductWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadProductWiki.json + // this example is just showing the usage of "ProductWiki_GetEntityTag" 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 ServiceProductWikiResource created on azure + // for more information of creating ServiceProductWikiResource, please refer to the document of ServiceProductWikiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier serviceProductWikiResourceId = ServiceProductWikiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductWikiResource serviceProductWiki = client.GetServiceProductWikiResource(serviceProductWikiResourceId); + + // invoke the operation + bool result = await serviceProductWiki.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetProductWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetProductWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetProductWiki.json + // this example is just showing the usage of "ProductWiki_Get" 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 ServiceProductWikiResource created on azure + // for more information of creating ServiceProductWikiResource, please refer to the document of ServiceProductWikiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier serviceProductWikiResourceId = ServiceProductWikiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductWikiResource serviceProductWiki = client.GetServiceProductWikiResource(serviceProductWikiResourceId); + + // invoke the operation + ServiceProductWikiResource result = await serviceProductWiki.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateProductWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateProductWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateProductWiki.json + // this example is just showing the usage of "ProductWiki_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 ServiceProductWikiResource created on azure + // for more information of creating ServiceProductWikiResource, please refer to the document of ServiceProductWikiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier serviceProductWikiResourceId = ServiceProductWikiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductWikiResource serviceProductWiki = client.GetServiceProductWikiResource(serviceProductWikiResourceId); + + // invoke the operation + WikiContractData data = new WikiContractData() + { + Documents = +{ +new WikiDocumentationContract() +{ +DocumentationId = "docId1", +},new WikiDocumentationContract() +{ +DocumentationId = "docId2", +} +}, + }; + ArmOperation lro = await serviceProductWiki.CreateOrUpdateAsync(WaitUntil.Completed, data); + ServiceProductWikiResource 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}"); + } + + // ApiManagementUpdateProductWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateProductWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateProductWiki.json + // this example is just showing the usage of "ProductWiki_Update" 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 ServiceProductWikiResource created on azure + // for more information of creating ServiceProductWikiResource, please refer to the document of ServiceProductWikiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier serviceProductWikiResourceId = ServiceProductWikiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductWikiResource serviceProductWiki = client.GetServiceProductWikiResource(serviceProductWikiResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + WikiUpdateContract wikiUpdateContract = new WikiUpdateContract() + { + Documents = +{ +new WikiDocumentationContract() +{ +DocumentationId = "docId1", +} +}, + }; + ServiceProductWikiResource result = await serviceProductWiki.UpdateAsync(ifMatch, wikiUpdateContract); + + // 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}"); + } + + // ApiManagementDeleteProductWiki + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteProductWiki() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteProductWiki.json + // this example is just showing the usage of "ProductWiki_Delete" 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 ServiceProductWikiResource created on azure + // for more information of creating ServiceProductWikiResource, please refer to the document of ServiceProductWikiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string productId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier serviceProductWikiResourceId = ServiceProductWikiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, productId); + ServiceProductWikiResource serviceProductWiki = client.GetServiceProductWikiResource(serviceProductWikiResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceProductWiki.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceSchemaCollection.cs similarity index 82% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceSchemaCollection.cs index 83704fcfc609..d20c21744bea 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceSchemaCollection.cs @@ -17,14 +17,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementGlobalSchemaCollection + public partial class Sample_ServiceSchemaCollection { // ApiManagementListSchemas [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListSchemas() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListGlobalSchemas.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListGlobalSchemas.json // this example is just showing the usage of "GlobalSchema_ListByService" 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 @@ -34,17 +34,17 @@ public async Task GetAll_ApiManagementListSchemas() // 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 = "subid"; + 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 ApiManagementGlobalSchemaResource - ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + // get the collection of this ServiceSchemaResource + ServiceSchemaCollection collection = apiManagementService.GetServiceSchemas(); // invoke the operation and iterate over the result - await foreach (ApiManagementGlobalSchemaResource item in collection.GetAllAsync()) + await foreach (ServiceSchemaResource item in collection.GetAllAsync()) { // the variable item 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 @@ -61,7 +61,7 @@ public async Task GetAll_ApiManagementListSchemas() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetSchema1() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema1.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGlobalSchema1.json // this example is just showing the usage of "GlobalSchema_Get" 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 @@ -71,18 +71,18 @@ public async Task Get_ApiManagementGetSchema1() // 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 = "subid"; + 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 ApiManagementGlobalSchemaResource - ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + // get the collection of this ServiceSchemaResource + ServiceSchemaCollection collection = apiManagementService.GetServiceSchemas(); // invoke the operation string schemaId = "schema1"; - ApiManagementGlobalSchemaResource result = await collection.GetAsync(schemaId); + ServiceSchemaResource result = await collection.GetAsync(schemaId); // 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 @@ -96,7 +96,7 @@ public async Task Get_ApiManagementGetSchema1() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetSchema1() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema1.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGlobalSchema1.json // this example is just showing the usage of "GlobalSchema_Get" 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 @@ -106,14 +106,14 @@ public async Task Exists_ApiManagementGetSchema1() // 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 = "subid"; + 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 ApiManagementGlobalSchemaResource - ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + // get the collection of this ServiceSchemaResource + ServiceSchemaCollection collection = apiManagementService.GetServiceSchemas(); // invoke the operation string schemaId = "schema1"; @@ -127,7 +127,7 @@ public async Task Exists_ApiManagementGetSchema1() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetSchema1() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema1.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGlobalSchema1.json // this example is just showing the usage of "GlobalSchema_Get" 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 @@ -137,19 +137,19 @@ public async Task GetIfExists_ApiManagementGetSchema1() // 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 = "subid"; + 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 ApiManagementGlobalSchemaResource - ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + // get the collection of this ServiceSchemaResource + ServiceSchemaCollection collection = apiManagementService.GetServiceSchemas(); // invoke the operation string schemaId = "schema1"; - NullableResponse response = await collection.GetIfExistsAsync(schemaId); - ApiManagementGlobalSchemaResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(schemaId); + ServiceSchemaResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -170,7 +170,7 @@ public async Task GetIfExists_ApiManagementGetSchema1() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetSchema2() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema2.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGlobalSchema2.json // this example is just showing the usage of "GlobalSchema_Get" 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 @@ -180,18 +180,18 @@ public async Task Get_ApiManagementGetSchema2() // 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 = "subid"; + 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 ApiManagementGlobalSchemaResource - ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + // get the collection of this ServiceSchemaResource + ServiceSchemaCollection collection = apiManagementService.GetServiceSchemas(); // invoke the operation string schemaId = "schema2"; - ApiManagementGlobalSchemaResource result = await collection.GetAsync(schemaId); + ServiceSchemaResource result = await collection.GetAsync(schemaId); // 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 @@ -205,7 +205,7 @@ public async Task Get_ApiManagementGetSchema2() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetSchema2() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema2.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGlobalSchema2.json // this example is just showing the usage of "GlobalSchema_Get" 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 @@ -215,14 +215,14 @@ public async Task Exists_ApiManagementGetSchema2() // 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 = "subid"; + 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 ApiManagementGlobalSchemaResource - ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + // get the collection of this ServiceSchemaResource + ServiceSchemaCollection collection = apiManagementService.GetServiceSchemas(); // invoke the operation string schemaId = "schema2"; @@ -236,7 +236,7 @@ public async Task Exists_ApiManagementGetSchema2() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetSchema2() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema2.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGlobalSchema2.json // this example is just showing the usage of "GlobalSchema_Get" 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 @@ -246,19 +246,19 @@ public async Task GetIfExists_ApiManagementGetSchema2() // 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 = "subid"; + 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 ApiManagementGlobalSchemaResource - ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + // get the collection of this ServiceSchemaResource + ServiceSchemaCollection collection = apiManagementService.GetServiceSchemas(); // invoke the operation string schemaId = "schema2"; - NullableResponse response = await collection.GetIfExistsAsync(schemaId); - ApiManagementGlobalSchemaResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(schemaId); + ServiceSchemaResource result = response.HasValue ? response.Value : null; if (result == null) { @@ -279,7 +279,7 @@ public async Task GetIfExists_ApiManagementGetSchema2() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateSchema1() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGlobalSchema1.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGlobalSchema1.json // this example is just showing the usage of "GlobalSchema_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 @@ -289,14 +289,14 @@ public async Task CreateOrUpdate_ApiManagementCreateSchema1() // 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 = "subid"; + 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 ApiManagementGlobalSchemaResource - ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + // get the collection of this ServiceSchemaResource + ServiceSchemaCollection collection = apiManagementService.GetServiceSchemas(); // invoke the operation string schemaId = "schema1"; @@ -306,8 +306,8 @@ public async Task CreateOrUpdate_ApiManagementCreateSchema1() Description = "sample schema description", Value = BinaryData.FromString("\"\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\""), }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaId, data); - ApiManagementGlobalSchemaResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaId, data); + ServiceSchemaResource 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 @@ -321,7 +321,7 @@ public async Task CreateOrUpdate_ApiManagementCreateSchema1() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateSchema2() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGlobalSchema2.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGlobalSchema2.json // this example is just showing the usage of "GlobalSchema_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 @@ -331,14 +331,14 @@ public async Task CreateOrUpdate_ApiManagementCreateSchema2() // 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 = "subid"; + 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 ApiManagementGlobalSchemaResource - ApiManagementGlobalSchemaCollection collection = apiManagementService.GetApiManagementGlobalSchemas(); + // get the collection of this ServiceSchemaResource + ServiceSchemaCollection collection = apiManagementService.GetServiceSchemas(); // invoke the operation string schemaId = "schema1"; @@ -373,8 +373,8 @@ public async Task CreateOrUpdate_ApiManagementCreateSchema2() ["title"] = "Person" }), }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaId, data); - ApiManagementGlobalSchemaResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaId, data); + ServiceSchemaResource 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 diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceSchemaResource.cs similarity index 66% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceSchemaResource.cs index 560a04fa0a45..8e7be8b8950a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ApiManagementGlobalSchemaResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceSchemaResource.cs @@ -17,14 +17,14 @@ namespace Azure.ResourceManager.ApiManagement.Samples { - public partial class Sample_ApiManagementGlobalSchemaResource + public partial class Sample_ServiceSchemaResource { // ApiManagementHeadApi [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadApi() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadGlobalSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadGlobalSchema.json // this example is just showing the usage of "GlobalSchema_GetEntityTag" 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 @@ -32,17 +32,17 @@ public async Task GetEntityTag_ApiManagementHeadApi() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGlobalSchemaResource created on azure - // for more information of creating ApiManagementGlobalSchemaResource, please refer to the document of ApiManagementGlobalSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceSchemaResource created on azure + // for more information of creating ServiceSchemaResource, please refer to the document of ServiceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string schemaId = "myschema"; - ResourceIdentifier apiManagementGlobalSchemaResourceId = ApiManagementGlobalSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); - ApiManagementGlobalSchemaResource apiManagementGlobalSchema = client.GetApiManagementGlobalSchemaResource(apiManagementGlobalSchemaResourceId); + ResourceIdentifier serviceSchemaResourceId = ServiceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); + ServiceSchemaResource serviceSchema = client.GetServiceSchemaResource(serviceSchemaResourceId); // invoke the operation - bool result = await apiManagementGlobalSchema.GetEntityTagAsync(); + bool result = await serviceSchema.GetEntityTagAsync(); Console.WriteLine($"Succeeded: {result}"); } @@ -52,7 +52,7 @@ public async Task GetEntityTag_ApiManagementHeadApi() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetSchema1() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema1.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGlobalSchema1.json // this example is just showing the usage of "GlobalSchema_Get" 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 @@ -60,17 +60,17 @@ public async Task Get_ApiManagementGetSchema1() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGlobalSchemaResource created on azure - // for more information of creating ApiManagementGlobalSchemaResource, please refer to the document of ApiManagementGlobalSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceSchemaResource created on azure + // for more information of creating ServiceSchemaResource, please refer to the document of ServiceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string schemaId = "schema1"; - ResourceIdentifier apiManagementGlobalSchemaResourceId = ApiManagementGlobalSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); - ApiManagementGlobalSchemaResource apiManagementGlobalSchema = client.GetApiManagementGlobalSchemaResource(apiManagementGlobalSchemaResourceId); + ResourceIdentifier serviceSchemaResourceId = ServiceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); + ServiceSchemaResource serviceSchema = client.GetServiceSchemaResource(serviceSchemaResourceId); // invoke the operation - ApiManagementGlobalSchemaResource result = await apiManagementGlobalSchema.GetAsync(); + ServiceSchemaResource result = await serviceSchema.GetAsync(); // 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 @@ -84,7 +84,7 @@ public async Task Get_ApiManagementGetSchema1() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetSchema2() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetGlobalSchema2.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetGlobalSchema2.json // this example is just showing the usage of "GlobalSchema_Get" 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 @@ -92,17 +92,17 @@ public async Task Get_ApiManagementGetSchema2() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGlobalSchemaResource created on azure - // for more information of creating ApiManagementGlobalSchemaResource, please refer to the document of ApiManagementGlobalSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceSchemaResource created on azure + // for more information of creating ServiceSchemaResource, please refer to the document of ServiceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string schemaId = "schema2"; - ResourceIdentifier apiManagementGlobalSchemaResourceId = ApiManagementGlobalSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); - ApiManagementGlobalSchemaResource apiManagementGlobalSchema = client.GetApiManagementGlobalSchemaResource(apiManagementGlobalSchemaResourceId); + ResourceIdentifier serviceSchemaResourceId = ServiceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); + ServiceSchemaResource serviceSchema = client.GetServiceSchemaResource(serviceSchemaResourceId); // invoke the operation - ApiManagementGlobalSchemaResource result = await apiManagementGlobalSchema.GetAsync(); + ServiceSchemaResource result = await serviceSchema.GetAsync(); // 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 @@ -116,7 +116,7 @@ public async Task Get_ApiManagementGetSchema2() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateSchema1() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGlobalSchema1.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGlobalSchema1.json // this example is just showing the usage of "GlobalSchema_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 @@ -124,14 +124,14 @@ public async Task Update_ApiManagementCreateSchema1() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGlobalSchemaResource created on azure - // for more information of creating ApiManagementGlobalSchemaResource, please refer to the document of ApiManagementGlobalSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceSchemaResource created on azure + // for more information of creating ServiceSchemaResource, please refer to the document of ServiceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string schemaId = "schema1"; - ResourceIdentifier apiManagementGlobalSchemaResourceId = ApiManagementGlobalSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); - ApiManagementGlobalSchemaResource apiManagementGlobalSchema = client.GetApiManagementGlobalSchemaResource(apiManagementGlobalSchemaResourceId); + ResourceIdentifier serviceSchemaResourceId = ServiceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); + ServiceSchemaResource serviceSchema = client.GetServiceSchemaResource(serviceSchemaResourceId); // invoke the operation ApiManagementGlobalSchemaData data = new ApiManagementGlobalSchemaData() @@ -140,8 +140,8 @@ public async Task Update_ApiManagementCreateSchema1() Description = "sample schema description", Value = BinaryData.FromString("\"\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\""), }; - ArmOperation lro = await apiManagementGlobalSchema.UpdateAsync(WaitUntil.Completed, data); - ApiManagementGlobalSchemaResource result = lro.Value; + ArmOperation lro = await serviceSchema.UpdateAsync(WaitUntil.Completed, data); + ServiceSchemaResource 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 @@ -155,7 +155,7 @@ public async Task Update_ApiManagementCreateSchema1() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementCreateSchema2() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateGlobalSchema2.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateGlobalSchema2.json // this example is just showing the usage of "GlobalSchema_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 @@ -163,14 +163,14 @@ public async Task Update_ApiManagementCreateSchema2() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGlobalSchemaResource created on azure - // for more information of creating ApiManagementGlobalSchemaResource, please refer to the document of ApiManagementGlobalSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceSchemaResource created on azure + // for more information of creating ServiceSchemaResource, please refer to the document of ServiceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string schemaId = "schema1"; - ResourceIdentifier apiManagementGlobalSchemaResourceId = ApiManagementGlobalSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); - ApiManagementGlobalSchemaResource apiManagementGlobalSchema = client.GetApiManagementGlobalSchemaResource(apiManagementGlobalSchemaResourceId); + ResourceIdentifier serviceSchemaResourceId = ServiceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); + ServiceSchemaResource serviceSchema = client.GetServiceSchemaResource(serviceSchemaResourceId); // invoke the operation ApiManagementGlobalSchemaData data = new ApiManagementGlobalSchemaData() @@ -204,8 +204,8 @@ public async Task Update_ApiManagementCreateSchema2() ["title"] = "Person" }), }; - ArmOperation lro = await apiManagementGlobalSchema.UpdateAsync(WaitUntil.Completed, data); - ApiManagementGlobalSchemaResource result = lro.Value; + ArmOperation lro = await serviceSchema.UpdateAsync(WaitUntil.Completed, data); + ServiceSchemaResource 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 @@ -219,7 +219,7 @@ public async Task Update_ApiManagementCreateSchema2() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ApiManagementDeleteSchema() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementDeleteGlobalSchema.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteGlobalSchema.json // this example is just showing the usage of "GlobalSchema_Delete" 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 @@ -227,18 +227,18 @@ public async Task Delete_ApiManagementDeleteSchema() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this ApiManagementGlobalSchemaResource created on azure - // for more information of creating ApiManagementGlobalSchemaResource, please refer to the document of ApiManagementGlobalSchemaResource - string subscriptionId = "subid"; + // this example assumes you already have this ServiceSchemaResource created on azure + // for more information of creating ServiceSchemaResource, please refer to the document of ServiceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; string schemaId = "schema1"; - ResourceIdentifier apiManagementGlobalSchemaResourceId = ApiManagementGlobalSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); - ApiManagementGlobalSchemaResource apiManagementGlobalSchema = client.GetApiManagementGlobalSchemaResource(apiManagementGlobalSchemaResourceId); + ResourceIdentifier serviceSchemaResourceId = ServiceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, schemaId); + ServiceSchemaResource serviceSchema = client.GetServiceSchemaResource(serviceSchemaResourceId); // invoke the operation ETag ifMatch = new ETag("*"); - await apiManagementGlobalSchema.DeleteAsync(WaitUntil.Completed, ifMatch); + await serviceSchema.DeleteAsync(WaitUntil.Completed, ifMatch); Console.WriteLine($"Succeeded"); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagApiLinkCollection.cs new file mode 100644 index 000000000000..3af51f5f66bb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagApiLinkCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceTagApiLinkCollection + { + // ApiManagementListTagApiLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListTagApiLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListTagApiLinks.json + // this example is just showing the usage of "TagApiLink_ListByProduct" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagApiLinkResource + ServiceTagApiLinkCollection collection = apiManagementTag.GetServiceTagApiLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceTagApiLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + TagApiLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagApiLink.json + // this example is just showing the usage of "TagApiLink_Get" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagApiLinkResource + ServiceTagApiLinkCollection collection = apiManagementTag.GetServiceTagApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + ServiceTagApiLinkResource result = await collection.GetAsync(apiLinkId); + + // 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagApiLink.json + // this example is just showing the usage of "TagApiLink_Get" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagApiLinkResource + ServiceTagApiLinkCollection collection = apiManagementTag.GetServiceTagApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + bool result = await collection.ExistsAsync(apiLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagApiLink.json + // this example is just showing the usage of "TagApiLink_Get" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagApiLinkResource + ServiceTagApiLinkCollection collection = apiManagementTag.GetServiceTagApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(apiLinkId); + ServiceTagApiLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateTagApiLink.json + // this example is just showing the usage of "TagApiLink_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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagApiLinkResource + ServiceTagApiLinkCollection collection = apiManagementTag.GetServiceTagApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + TagApiLinkContractData data = new TagApiLinkContractData() + { + ApiId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiLinkId, data); + ServiceTagApiLinkResource 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagApiLinkResource.cs new file mode 100644 index 000000000000..ccecc9e572df --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagApiLinkResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceTagApiLinkResource + { + // ApiManagementGetTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagApiLink.json + // this example is just showing the usage of "TagApiLink_Get" 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 ServiceTagApiLinkResource created on azure + // for more information of creating ServiceTagApiLinkResource, please refer to the document of ServiceTagApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + string apiLinkId = "link1"; + ResourceIdentifier serviceTagApiLinkResourceId = ServiceTagApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + ServiceTagApiLinkResource serviceTagApiLink = client.GetServiceTagApiLinkResource(serviceTagApiLinkResourceId); + + // invoke the operation + ServiceTagApiLinkResource result = await serviceTagApiLink.GetAsync(); + + // 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateTagApiLink.json + // this example is just showing the usage of "TagApiLink_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 ServiceTagApiLinkResource created on azure + // for more information of creating ServiceTagApiLinkResource, please refer to the document of ServiceTagApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + string apiLinkId = "link1"; + ResourceIdentifier serviceTagApiLinkResourceId = ServiceTagApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + ServiceTagApiLinkResource serviceTagApiLink = client.GetServiceTagApiLinkResource(serviceTagApiLinkResourceId); + + // invoke the operation + TagApiLinkContractData data = new TagApiLinkContractData() + { + ApiId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api", + }; + ArmOperation lro = await serviceTagApiLink.UpdateAsync(WaitUntil.Completed, data); + ServiceTagApiLinkResource 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteTagApiLink.json + // this example is just showing the usage of "TagApiLink_Delete" 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 ServiceTagApiLinkResource created on azure + // for more information of creating ServiceTagApiLinkResource, please refer to the document of ServiceTagApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + string apiLinkId = "link1"; + ResourceIdentifier serviceTagApiLinkResourceId = ServiceTagApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + ServiceTagApiLinkResource serviceTagApiLink = client.GetServiceTagApiLinkResource(serviceTagApiLinkResourceId); + + // invoke the operation + await serviceTagApiLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagOperationLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagOperationLinkCollection.cs new file mode 100644 index 000000000000..2ad6d097e33d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagOperationLinkCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceTagOperationLinkCollection + { + // ApiManagementListTagOperationLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListTagOperationLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListTagOperationLinks.json + // this example is just showing the usage of "TagOperationLink_ListByProduct" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagOperationLinkResource + ServiceTagOperationLinkCollection collection = apiManagementTag.GetServiceTagOperationLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceTagOperationLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + TagOperationLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagOperationLink.json + // this example is just showing the usage of "TagOperationLink_Get" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagOperationLinkResource + ServiceTagOperationLinkCollection collection = apiManagementTag.GetServiceTagOperationLinks(); + + // invoke the operation + string operationLinkId = "link1"; + ServiceTagOperationLinkResource result = await collection.GetAsync(operationLinkId); + + // 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagOperationLink.json + // this example is just showing the usage of "TagOperationLink_Get" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagOperationLinkResource + ServiceTagOperationLinkCollection collection = apiManagementTag.GetServiceTagOperationLinks(); + + // invoke the operation + string operationLinkId = "link1"; + bool result = await collection.ExistsAsync(operationLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagOperationLink.json + // this example is just showing the usage of "TagOperationLink_Get" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagOperationLinkResource + ServiceTagOperationLinkCollection collection = apiManagementTag.GetServiceTagOperationLinks(); + + // invoke the operation + string operationLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(operationLinkId); + ServiceTagOperationLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateTagOperationLink.json + // this example is just showing the usage of "TagOperationLink_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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagOperationLinkResource + ServiceTagOperationLinkCollection collection = apiManagementTag.GetServiceTagOperationLinks(); + + // invoke the operation + string operationLinkId = "link1"; + TagOperationLinkContractData data = new TagOperationLinkContractData() + { + OperationId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/operations/op1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, operationLinkId, data); + ServiceTagOperationLinkResource 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagOperationLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagOperationLinkResource.cs new file mode 100644 index 000000000000..cff97a37d9c7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagOperationLinkResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceTagOperationLinkResource + { + // ApiManagementGetTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagOperationLink.json + // this example is just showing the usage of "TagOperationLink_Get" 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 ServiceTagOperationLinkResource created on azure + // for more information of creating ServiceTagOperationLinkResource, please refer to the document of ServiceTagOperationLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + string operationLinkId = "link1"; + ResourceIdentifier serviceTagOperationLinkResourceId = ServiceTagOperationLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + ServiceTagOperationLinkResource serviceTagOperationLink = client.GetServiceTagOperationLinkResource(serviceTagOperationLinkResourceId); + + // invoke the operation + ServiceTagOperationLinkResource result = await serviceTagOperationLink.GetAsync(); + + // 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateTagOperationLink.json + // this example is just showing the usage of "TagOperationLink_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 ServiceTagOperationLinkResource created on azure + // for more information of creating ServiceTagOperationLinkResource, please refer to the document of ServiceTagOperationLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + string operationLinkId = "link1"; + ResourceIdentifier serviceTagOperationLinkResourceId = ServiceTagOperationLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + ServiceTagOperationLinkResource serviceTagOperationLink = client.GetServiceTagOperationLinkResource(serviceTagOperationLinkResourceId); + + // invoke the operation + TagOperationLinkContractData data = new TagOperationLinkContractData() + { + OperationId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/operations/op1", + }; + ArmOperation lro = await serviceTagOperationLink.UpdateAsync(WaitUntil.Completed, data); + ServiceTagOperationLinkResource 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteTagOperationLink.json + // this example is just showing the usage of "TagOperationLink_Delete" 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 ServiceTagOperationLinkResource created on azure + // for more information of creating ServiceTagOperationLinkResource, please refer to the document of ServiceTagOperationLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + string operationLinkId = "link1"; + ResourceIdentifier serviceTagOperationLinkResourceId = ServiceTagOperationLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + ServiceTagOperationLinkResource serviceTagOperationLink = client.GetServiceTagOperationLinkResource(serviceTagOperationLinkResourceId); + + // invoke the operation + await serviceTagOperationLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagProductLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagProductLinkCollection.cs new file mode 100644 index 000000000000..56b8abb01437 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagProductLinkCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceTagProductLinkCollection + { + // ApiManagementListTagProductLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListTagProductLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListTagProductLinks.json + // this example is just showing the usage of "TagProductLink_ListByProduct" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagProductLinkResource + ServiceTagProductLinkCollection collection = apiManagementTag.GetServiceTagProductLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceTagProductLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + TagProductLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagProductLink.json + // this example is just showing the usage of "TagProductLink_Get" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagProductLinkResource + ServiceTagProductLinkCollection collection = apiManagementTag.GetServiceTagProductLinks(); + + // invoke the operation + string productLinkId = "link1"; + ServiceTagProductLinkResource result = await collection.GetAsync(productLinkId); + + // 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagProductLink.json + // this example is just showing the usage of "TagProductLink_Get" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagProductLinkResource + ServiceTagProductLinkCollection collection = apiManagementTag.GetServiceTagProductLinks(); + + // invoke the operation + string productLinkId = "link1"; + bool result = await collection.ExistsAsync(productLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagProductLink.json + // this example is just showing the usage of "TagProductLink_Get" 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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagProductLinkResource + ServiceTagProductLinkCollection collection = apiManagementTag.GetServiceTagProductLinks(); + + // invoke the operation + string productLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(productLinkId); + ServiceTagProductLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateTagProductLink.json + // this example is just showing the usage of "TagProductLink_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 ApiManagementTagResource created on azure + // for more information of creating ApiManagementTagResource, please refer to the document of ApiManagementTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + ResourceIdentifier apiManagementTagResourceId = ApiManagementTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId); + ApiManagementTagResource apiManagementTag = client.GetApiManagementTagResource(apiManagementTagResourceId); + + // get the collection of this ServiceTagProductLinkResource + ServiceTagProductLinkCollection collection = apiManagementTag.GetServiceTagProductLinks(); + + // invoke the operation + string productLinkId = "link1"; + TagProductLinkContractData data = new TagProductLinkContractData() + { + ProductId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/product1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, productLinkId, data); + ServiceTagProductLinkResource 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagProductLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagProductLinkResource.cs new file mode 100644 index 000000000000..a1079bf7e477 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceTagProductLinkResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceTagProductLinkResource + { + // ApiManagementGetTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTagProductLink.json + // this example is just showing the usage of "TagProductLink_Get" 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 ServiceTagProductLinkResource created on azure + // for more information of creating ServiceTagProductLinkResource, please refer to the document of ServiceTagProductLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + string productLinkId = "link1"; + ResourceIdentifier serviceTagProductLinkResourceId = ServiceTagProductLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + ServiceTagProductLinkResource serviceTagProductLink = client.GetServiceTagProductLinkResource(serviceTagProductLinkResourceId); + + // invoke the operation + ServiceTagProductLinkResource result = await serviceTagProductLink.GetAsync(); + + // 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateTagProductLink.json + // this example is just showing the usage of "TagProductLink_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 ServiceTagProductLinkResource created on azure + // for more information of creating ServiceTagProductLinkResource, please refer to the document of ServiceTagProductLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + string productLinkId = "link1"; + ResourceIdentifier serviceTagProductLinkResourceId = ServiceTagProductLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + ServiceTagProductLinkResource serviceTagProductLink = client.GetServiceTagProductLinkResource(serviceTagProductLinkResourceId); + + // invoke the operation + TagProductLinkContractData data = new TagProductLinkContractData() + { + ProductId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/product1", + }; + ArmOperation lro = await serviceTagProductLink.UpdateAsync(WaitUntil.Completed, data); + ServiceTagProductLinkResource 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteTagProductLink.json + // this example is just showing the usage of "TagProductLink_Delete" 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 ServiceTagProductLinkResource created on azure + // for more information of creating ServiceTagProductLinkResource, please refer to the document of ServiceTagProductLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string tagId = "tag1"; + string productLinkId = "link1"; + ResourceIdentifier serviceTagProductLinkResourceId = ServiceTagProductLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + ServiceTagProductLinkResource serviceTagProductLink = client.GetServiceTagProductLinkResource(serviceTagProductLinkResourceId); + + // invoke the operation + await serviceTagProductLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiCollection.cs new file mode 100644 index 000000000000..7224ee542339 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiCollection.cs @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiCollection + { + // ApiManagementListWorkspaceApis + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceApis() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceApis.json + // this example is just showing the usage of "WorkspaceApi_ListByService" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiResource + ServiceWorkspaceApiCollection collection = workspaceContract.GetServiceWorkspaceApis(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceApiResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceApiContract + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiContract() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiContract.json + // this example is just showing the usage of "WorkspaceApi_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiResource + ServiceWorkspaceApiCollection collection = workspaceContract.GetServiceWorkspaceApis(); + + // invoke the operation + string apiId = "57d1f7558aa04f15146d9d8a"; + ServiceWorkspaceApiResource result = await collection.GetAsync(apiId); + + // 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}"); + } + + // ApiManagementGetWorkspaceApiContract + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceApiContract() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiContract.json + // this example is just showing the usage of "WorkspaceApi_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiResource + ServiceWorkspaceApiCollection collection = workspaceContract.GetServiceWorkspaceApis(); + + // invoke the operation + string apiId = "57d1f7558aa04f15146d9d8a"; + bool result = await collection.ExistsAsync(apiId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiContract + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceApiContract() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiContract.json + // this example is just showing the usage of "WorkspaceApi_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiResource + ServiceWorkspaceApiCollection collection = workspaceContract.GetServiceWorkspaceApis(); + + // invoke the operation + string apiId = "57d1f7558aa04f15146d9d8a"; + NullableResponse response = await collection.GetIfExistsAsync(apiId); + ServiceWorkspaceApiResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementGetWorkspaceApiRevision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiRevision() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiRevision.json + // this example is just showing the usage of "WorkspaceApi_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiResource + ServiceWorkspaceApiCollection collection = workspaceContract.GetServiceWorkspaceApis(); + + // invoke the operation + string apiId = "echo-api;rev=3"; + ServiceWorkspaceApiResource result = await collection.GetAsync(apiId); + + // 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}"); + } + + // ApiManagementGetWorkspaceApiRevision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceApiRevision() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiRevision.json + // this example is just showing the usage of "WorkspaceApi_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiResource + ServiceWorkspaceApiCollection collection = workspaceContract.GetServiceWorkspaceApis(); + + // invoke the operation + string apiId = "echo-api;rev=3"; + bool result = await collection.ExistsAsync(apiId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiRevision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceApiRevision() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiRevision.json + // this example is just showing the usage of "WorkspaceApi_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiResource + ServiceWorkspaceApiCollection collection = workspaceContract.GetServiceWorkspaceApis(); + + // invoke the operation + string apiId = "echo-api;rev=3"; + NullableResponse response = await collection.GetIfExistsAsync(apiId); + ServiceWorkspaceApiResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateWorkspaceApi + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceApi() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApi.json + // this example is just showing the usage of "WorkspaceApi_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiResource + ServiceWorkspaceApiCollection collection = workspaceContract.GetServiceWorkspaceApis(); + + // invoke the operation + string apiId = "tempgroup"; + ApiCreateOrUpdateParameter apiCreateOrUpdateParameter = new ApiCreateOrUpdateParameter() + { + Description = "apidescription5200", + AuthenticationSettings = new AuthenticationSettingsContract() + { + OAuth2 = new OAuth2AuthenticationSettingsContract() + { + AuthorizationServerId = "authorizationServerId2283", + Scope = "oauth2scope2580", + }, + }, + SubscriptionKeyParameterNames = new SubscriptionKeyParameterNamesContract() + { + Header = "header4520", + Query = "query3037", + }, + DisplayName = "apiname1463", + ServiceUri = new Uri("http://newechoapi.cloudapp.net/api"), + Path = "newapiPath", + Protocols = +{ +ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, apiCreateOrUpdateParameter); + ServiceWorkspaceApiResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationCollection.cs new file mode 100644 index 000000000000..148dd142efec --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationCollection.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiOperationCollection + { + // ApiManagementListWorkspaceApiOperations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceApiOperations() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceApiOperations.json + // this example is just showing the usage of "WorkspaceApiOperation_ListByApi" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiOperationResource + ServiceWorkspaceApiOperationCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiOperations(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceApiOperationResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceApiOperation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiOperation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiOperation.json + // this example is just showing the usage of "WorkspaceApiOperation_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiOperationResource + ServiceWorkspaceApiOperationCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiOperations(); + + // invoke the operation + string operationId = "57d2ef278aa04f0ad01d6cdc"; + ServiceWorkspaceApiOperationResource result = await collection.GetAsync(operationId); + + // 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}"); + } + + // ApiManagementGetWorkspaceApiOperation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceApiOperation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiOperation.json + // this example is just showing the usage of "WorkspaceApiOperation_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiOperationResource + ServiceWorkspaceApiOperationCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiOperations(); + + // invoke the operation + string operationId = "57d2ef278aa04f0ad01d6cdc"; + bool result = await collection.ExistsAsync(operationId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiOperation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceApiOperation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiOperation.json + // this example is just showing the usage of "WorkspaceApiOperation_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiOperationResource + ServiceWorkspaceApiOperationCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiOperations(); + + // invoke the operation + string operationId = "57d2ef278aa04f0ad01d6cdc"; + NullableResponse response = await collection.GetIfExistsAsync(operationId); + ServiceWorkspaceApiOperationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateWorkspaceApiOperation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceApiOperation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApiOperation.json + // this example is just showing the usage of "WorkspaceApiOperation_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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "PetStoreTemplate2"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiOperationResource + ServiceWorkspaceApiOperationCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiOperations(); + + // 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 lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, operationId, data); + ServiceWorkspaceApiOperationResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationPolicyCollection.cs new file mode 100644 index 000000000000..1af7e3900ecd --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationPolicyCollection.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiOperationPolicyCollection + { + // ApiManagementListWorkspaceApiOperationPolicies + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceApiOperationPolicies() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceApiOperationPolicies.json + // this example is just showing the usage of "WorkspaceApiOperationPolicy_ListByOperation" 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 ServiceWorkspaceApiOperationResource created on azure + // for more information of creating ServiceWorkspaceApiOperationResource, please refer to the document of ServiceWorkspaceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "599e2953193c3c0bd0b3e2fa"; + string operationId = "599e29ab193c3c0bd0b3e2fb"; + ResourceIdentifier serviceWorkspaceApiOperationResourceId = ServiceWorkspaceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + ServiceWorkspaceApiOperationResource serviceWorkspaceApiOperation = client.GetServiceWorkspaceApiOperationResource(serviceWorkspaceApiOperationResourceId); + + // get the collection of this ServiceWorkspaceApiOperationPolicyResource + ServiceWorkspaceApiOperationPolicyCollection collection = serviceWorkspaceApiOperation.GetServiceWorkspaceApiOperationPolicies(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceApiOperationPolicyResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceApiOperationPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiOperationPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiOperationPolicy.json + // this example is just showing the usage of "WorkspaceApiOperationPolicy_Get" 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 ServiceWorkspaceApiOperationResource created on azure + // for more information of creating ServiceWorkspaceApiOperationResource, please refer to the document of ServiceWorkspaceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b539c53f5b0062040001"; + string operationId = "5600b53ac53f5b0062080006"; + ResourceIdentifier serviceWorkspaceApiOperationResourceId = ServiceWorkspaceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + ServiceWorkspaceApiOperationResource serviceWorkspaceApiOperation = client.GetServiceWorkspaceApiOperationResource(serviceWorkspaceApiOperationResourceId); + + // get the collection of this ServiceWorkspaceApiOperationPolicyResource + ServiceWorkspaceApiOperationPolicyCollection collection = serviceWorkspaceApiOperation.GetServiceWorkspaceApiOperationPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + ServiceWorkspaceApiOperationPolicyResource result = await collection.GetAsync(policyId); + + // 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}"); + } + + // ApiManagementGetWorkspaceApiOperationPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceApiOperationPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiOperationPolicy.json + // this example is just showing the usage of "WorkspaceApiOperationPolicy_Get" 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 ServiceWorkspaceApiOperationResource created on azure + // for more information of creating ServiceWorkspaceApiOperationResource, please refer to the document of ServiceWorkspaceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b539c53f5b0062040001"; + string operationId = "5600b53ac53f5b0062080006"; + ResourceIdentifier serviceWorkspaceApiOperationResourceId = ServiceWorkspaceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + ServiceWorkspaceApiOperationResource serviceWorkspaceApiOperation = client.GetServiceWorkspaceApiOperationResource(serviceWorkspaceApiOperationResourceId); + + // get the collection of this ServiceWorkspaceApiOperationPolicyResource + ServiceWorkspaceApiOperationPolicyCollection collection = serviceWorkspaceApiOperation.GetServiceWorkspaceApiOperationPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + bool result = await collection.ExistsAsync(policyId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiOperationPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceApiOperationPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiOperationPolicy.json + // this example is just showing the usage of "WorkspaceApiOperationPolicy_Get" 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 ServiceWorkspaceApiOperationResource created on azure + // for more information of creating ServiceWorkspaceApiOperationResource, please refer to the document of ServiceWorkspaceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b539c53f5b0062040001"; + string operationId = "5600b53ac53f5b0062080006"; + ResourceIdentifier serviceWorkspaceApiOperationResourceId = ServiceWorkspaceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + ServiceWorkspaceApiOperationResource serviceWorkspaceApiOperation = client.GetServiceWorkspaceApiOperationResource(serviceWorkspaceApiOperationResourceId); + + // get the collection of this ServiceWorkspaceApiOperationPolicyResource + ServiceWorkspaceApiOperationPolicyCollection collection = serviceWorkspaceApiOperation.GetServiceWorkspaceApiOperationPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + NullableResponse response = await collection.GetIfExistsAsync(policyId); + ServiceWorkspaceApiOperationPolicyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateWorkspaceApiOperationPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceApiOperationPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApiOperationPolicy.json + // this example is just showing the usage of "WorkspaceApiOperationPolicy_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 ServiceWorkspaceApiOperationResource created on azure + // for more information of creating ServiceWorkspaceApiOperationResource, please refer to the document of ServiceWorkspaceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b57e7e8880006a040001"; + string operationId = "5600b57e7e8880006a080001"; + ResourceIdentifier serviceWorkspaceApiOperationResourceId = ServiceWorkspaceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + ServiceWorkspaceApiOperationResource serviceWorkspaceApiOperation = client.GetServiceWorkspaceApiOperationResource(serviceWorkspaceApiOperationResourceId); + + // get the collection of this ServiceWorkspaceApiOperationPolicyResource + ServiceWorkspaceApiOperationPolicyCollection collection = serviceWorkspaceApiOperation.GetServiceWorkspaceApiOperationPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + PolicyContractData data = new PolicyContractData() + { + Value = " ", + Format = PolicyContentFormat.Xml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyId, data, ifMatch: ifMatch); + ServiceWorkspaceApiOperationPolicyResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationPolicyResource.cs new file mode 100644 index 000000000000..04e90f0e2e21 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationPolicyResource.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiOperationPolicyResource + { + // ApiManagementHeadWorkspaceApiOperationPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceApiOperationPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceApiOperationPolicy.json + // this example is just showing the usage of "WorkspaceApiOperationPolicy_GetEntityTag" 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 ServiceWorkspaceApiOperationPolicyResource created on azure + // for more information of creating ServiceWorkspaceApiOperationPolicyResource, please refer to the document of ServiceWorkspaceApiOperationPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b539c53f5b0062040001"; + string operationId = "5600b53ac53f5b0062080006"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceApiOperationPolicyResourceId = ServiceWorkspaceApiOperationPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId); + ServiceWorkspaceApiOperationPolicyResource serviceWorkspaceApiOperationPolicy = client.GetServiceWorkspaceApiOperationPolicyResource(serviceWorkspaceApiOperationPolicyResourceId); + + // invoke the operation + bool result = await serviceWorkspaceApiOperationPolicy.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiOperationPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiOperationPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiOperationPolicy.json + // this example is just showing the usage of "WorkspaceApiOperationPolicy_Get" 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 ServiceWorkspaceApiOperationPolicyResource created on azure + // for more information of creating ServiceWorkspaceApiOperationPolicyResource, please refer to the document of ServiceWorkspaceApiOperationPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b539c53f5b0062040001"; + string operationId = "5600b53ac53f5b0062080006"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceApiOperationPolicyResourceId = ServiceWorkspaceApiOperationPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId); + ServiceWorkspaceApiOperationPolicyResource serviceWorkspaceApiOperationPolicy = client.GetServiceWorkspaceApiOperationPolicyResource(serviceWorkspaceApiOperationPolicyResourceId); + + // invoke the operation + ServiceWorkspaceApiOperationPolicyResource result = await serviceWorkspaceApiOperationPolicy.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateWorkspaceApiOperationPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceApiOperationPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApiOperationPolicy.json + // this example is just showing the usage of "WorkspaceApiOperationPolicy_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 ServiceWorkspaceApiOperationPolicyResource created on azure + // for more information of creating ServiceWorkspaceApiOperationPolicyResource, please refer to the document of ServiceWorkspaceApiOperationPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b57e7e8880006a040001"; + string operationId = "5600b57e7e8880006a080001"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceApiOperationPolicyResourceId = ServiceWorkspaceApiOperationPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId); + ServiceWorkspaceApiOperationPolicyResource serviceWorkspaceApiOperationPolicy = client.GetServiceWorkspaceApiOperationPolicyResource(serviceWorkspaceApiOperationPolicyResourceId); + + // invoke the operation + PolicyContractData data = new PolicyContractData() + { + Value = " ", + Format = PolicyContentFormat.Xml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await serviceWorkspaceApiOperationPolicy.UpdateAsync(WaitUntil.Completed, data, ifMatch: ifMatch); + ServiceWorkspaceApiOperationPolicyResource 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}"); + } + + // ApiManagementDeleteWorkspaceApiOperationPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceApiOperationPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceApiOperationPolicy.json + // this example is just showing the usage of "WorkspaceApiOperationPolicy_Delete" 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 ServiceWorkspaceApiOperationPolicyResource created on azure + // for more information of creating ServiceWorkspaceApiOperationPolicyResource, please refer to the document of ServiceWorkspaceApiOperationPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "testapi"; + string operationId = "testoperation"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceApiOperationPolicyResourceId = ServiceWorkspaceApiOperationPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId); + ServiceWorkspaceApiOperationPolicyResource serviceWorkspaceApiOperationPolicy = client.GetServiceWorkspaceApiOperationPolicyResource(serviceWorkspaceApiOperationPolicyResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceApiOperationPolicy.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationResource.cs new file mode 100644 index 000000000000..8576caa84de4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiOperationResource.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiOperationResource + { + // ApiManagementHeadWorkspaceApiOperation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceApiOperation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceApiOperation.json + // this example is just showing the usage of "WorkspaceApiOperation_GetEntityTag" 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 ServiceWorkspaceApiOperationResource created on azure + // for more information of creating ServiceWorkspaceApiOperationResource, please refer to the document of ServiceWorkspaceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + string operationId = "57d2ef278aa04f0ad01d6cdc"; + ResourceIdentifier serviceWorkspaceApiOperationResourceId = ServiceWorkspaceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + ServiceWorkspaceApiOperationResource serviceWorkspaceApiOperation = client.GetServiceWorkspaceApiOperationResource(serviceWorkspaceApiOperationResourceId); + + // invoke the operation + bool result = await serviceWorkspaceApiOperation.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiOperation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiOperation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiOperation.json + // this example is just showing the usage of "WorkspaceApiOperation_Get" 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 ServiceWorkspaceApiOperationResource created on azure + // for more information of creating ServiceWorkspaceApiOperationResource, please refer to the document of ServiceWorkspaceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + string operationId = "57d2ef278aa04f0ad01d6cdc"; + ResourceIdentifier serviceWorkspaceApiOperationResourceId = ServiceWorkspaceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + ServiceWorkspaceApiOperationResource serviceWorkspaceApiOperation = client.GetServiceWorkspaceApiOperationResource(serviceWorkspaceApiOperationResourceId); + + // invoke the operation + ServiceWorkspaceApiOperationResource result = await serviceWorkspaceApiOperation.GetAsync(); + + // 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}"); + } + + // ApiManagementUpdateWorkspaceApiOperation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspaceApiOperation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspaceApiOperation.json + // this example is just showing the usage of "WorkspaceApiOperation_Update" 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 ServiceWorkspaceApiOperationResource created on azure + // for more information of creating ServiceWorkspaceApiOperationResource, please refer to the document of ServiceWorkspaceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "echo-api"; + string operationId = "operationId"; + ResourceIdentifier serviceWorkspaceApiOperationResourceId = ServiceWorkspaceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + ServiceWorkspaceApiOperationResource serviceWorkspaceApiOperation = client.GetServiceWorkspaceApiOperationResource(serviceWorkspaceApiOperationResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + OperationUpdateContract operationUpdateContract = new OperationUpdateContract() + { + TemplateParameters = +{ +}, + Request = new RequestContract() + { + QueryParameters = +{ +new ParameterContract("param1","string") +{ +Description = "A sample parameter that is required and has a default value of \"sample\".", +DefaultValue = "sample", +IsRequired = true, +Values = +{ +"sample" +}, +} +}, + }, + Responses = +{ +new ResponseContract(200) +{ +Description = "Returned in all cases.", +Representations = +{ +}, +Headers = +{ +}, +},new ResponseContract(500) +{ +Description = "Server Error.", +Representations = +{ +}, +Headers = +{ +}, +} +}, + DisplayName = "Retrieve resource", + Method = "GET", + UriTemplate = "/resource", + }; + ServiceWorkspaceApiOperationResource result = await serviceWorkspaceApiOperation.UpdateAsync(ifMatch, operationUpdateContract); + + // 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}"); + } + + // ApiManagementDeleteWorkspaceApiOperation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceApiOperation() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceApiOperation.json + // this example is just showing the usage of "WorkspaceApiOperation_Delete" 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 ServiceWorkspaceApiOperationResource created on azure + // for more information of creating ServiceWorkspaceApiOperationResource, please refer to the document of ServiceWorkspaceApiOperationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + string operationId = "57d2ef278aa04f0ad01d6cdc"; + ResourceIdentifier serviceWorkspaceApiOperationResourceId = ServiceWorkspaceApiOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + ServiceWorkspaceApiOperationResource serviceWorkspaceApiOperation = client.GetServiceWorkspaceApiOperationResource(serviceWorkspaceApiOperationResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceApiOperation.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiPolicyCollection.cs new file mode 100644 index 000000000000..2eae65daae40 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiPolicyCollection.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiPolicyCollection + { + // ApiManagementListWorkspaceApiPolicies + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceApiPolicies() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceApiPolicies.json + // this example is just showing the usage of "WorkspaceApiPolicy_ListByApi" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b59475ff190048040001"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiPolicyResource + ServiceWorkspaceApiPolicyCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiPolicies(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceApiPolicyResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceApiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiPolicy.json + // this example is just showing the usage of "WorkspaceApiPolicy_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b59475ff190048040001"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiPolicyResource + ServiceWorkspaceApiPolicyCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + ServiceWorkspaceApiPolicyResource result = await collection.GetAsync(policyId); + + // 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}"); + } + + // ApiManagementGetWorkspaceApiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceApiPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiPolicy.json + // this example is just showing the usage of "WorkspaceApiPolicy_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b59475ff190048040001"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiPolicyResource + ServiceWorkspaceApiPolicyCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + bool result = await collection.ExistsAsync(policyId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceApiPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiPolicy.json + // this example is just showing the usage of "WorkspaceApiPolicy_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b59475ff190048040001"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiPolicyResource + ServiceWorkspaceApiPolicyCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + NullableResponse response = await collection.GetIfExistsAsync(policyId); + ServiceWorkspaceApiPolicyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateWorkspaceApiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceApiPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApiPolicy.json + // this example is just showing the usage of "WorkspaceApiPolicy_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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b57e7e8880006a040001"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiPolicyResource + ServiceWorkspaceApiPolicyCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + PolicyContractData data = new PolicyContractData() + { + Value = " ", + Format = PolicyContentFormat.Xml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyId, data, ifMatch: ifMatch); + ServiceWorkspaceApiPolicyResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiPolicyResource.cs new file mode 100644 index 000000000000..284b864f4947 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiPolicyResource.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiPolicyResource + { + // ApiManagementHeadWorkspaceApiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceApiPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceApiPolicy.json + // this example is just showing the usage of "WorkspaceApiPolicy_GetEntityTag" 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 ServiceWorkspaceApiPolicyResource created on azure + // for more information of creating ServiceWorkspaceApiPolicyResource, please refer to the document of ServiceWorkspaceApiPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d1f7558aa04f15146d9d8a"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceApiPolicyResourceId = ServiceWorkspaceApiPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId); + ServiceWorkspaceApiPolicyResource serviceWorkspaceApiPolicy = client.GetServiceWorkspaceApiPolicyResource(serviceWorkspaceApiPolicyResourceId); + + // invoke the operation + bool result = await serviceWorkspaceApiPolicy.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiPolicy.json + // this example is just showing the usage of "WorkspaceApiPolicy_Get" 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 ServiceWorkspaceApiPolicyResource created on azure + // for more information of creating ServiceWorkspaceApiPolicyResource, please refer to the document of ServiceWorkspaceApiPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b59475ff190048040001"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceApiPolicyResourceId = ServiceWorkspaceApiPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId); + ServiceWorkspaceApiPolicyResource serviceWorkspaceApiPolicy = client.GetServiceWorkspaceApiPolicyResource(serviceWorkspaceApiPolicyResourceId); + + // invoke the operation + ServiceWorkspaceApiPolicyResource result = await serviceWorkspaceApiPolicy.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateWorkspaceApiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceApiPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApiPolicy.json + // this example is just showing the usage of "WorkspaceApiPolicy_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 ServiceWorkspaceApiPolicyResource created on azure + // for more information of creating ServiceWorkspaceApiPolicyResource, please refer to the document of ServiceWorkspaceApiPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5600b57e7e8880006a040001"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceApiPolicyResourceId = ServiceWorkspaceApiPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId); + ServiceWorkspaceApiPolicyResource serviceWorkspaceApiPolicy = client.GetServiceWorkspaceApiPolicyResource(serviceWorkspaceApiPolicyResourceId); + + // invoke the operation + PolicyContractData data = new PolicyContractData() + { + Value = " ", + Format = PolicyContentFormat.Xml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await serviceWorkspaceApiPolicy.UpdateAsync(WaitUntil.Completed, data, ifMatch: ifMatch); + ServiceWorkspaceApiPolicyResource 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}"); + } + + // ApiManagementDeleteWorkspaceApiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceApiPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceApiPolicy.json + // this example is just showing the usage of "WorkspaceApiPolicy_Delete" 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 ServiceWorkspaceApiPolicyResource created on azure + // for more information of creating ServiceWorkspaceApiPolicyResource, please refer to the document of ServiceWorkspaceApiPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "loggerId"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceApiPolicyResourceId = ServiceWorkspaceApiPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId); + ServiceWorkspaceApiPolicyResource serviceWorkspaceApiPolicy = client.GetServiceWorkspaceApiPolicyResource(serviceWorkspaceApiPolicyResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceApiPolicy.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiReleaseCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiReleaseCollection.cs new file mode 100644 index 000000000000..c34ac03b3d9c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiReleaseCollection.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiReleaseCollection + { + // ApiManagementListWorkspaceApiReleases + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceApiReleases() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceApiReleases.json + // this example is just showing the usage of "WorkspaceApiRelease_ListByService" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "a1"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiReleaseResource + ServiceWorkspaceApiReleaseCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiReleases(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceApiReleaseResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceApiRelease + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiRelease() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiRelease.json + // this example is just showing the usage of "WorkspaceApiRelease_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "a1"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiReleaseResource + ServiceWorkspaceApiReleaseCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiReleases(); + + // invoke the operation + string releaseId = "5a7cb545298324c53224a799"; + ServiceWorkspaceApiReleaseResource result = await collection.GetAsync(releaseId); + + // 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}"); + } + + // ApiManagementGetWorkspaceApiRelease + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceApiRelease() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiRelease.json + // this example is just showing the usage of "WorkspaceApiRelease_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "a1"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiReleaseResource + ServiceWorkspaceApiReleaseCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiReleases(); + + // invoke the operation + string releaseId = "5a7cb545298324c53224a799"; + bool result = await collection.ExistsAsync(releaseId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiRelease + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceApiRelease() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiRelease.json + // this example is just showing the usage of "WorkspaceApiRelease_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "a1"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiReleaseResource + ServiceWorkspaceApiReleaseCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiReleases(); + + // invoke the operation + string releaseId = "5a7cb545298324c53224a799"; + NullableResponse response = await collection.GetIfExistsAsync(releaseId); + ServiceWorkspaceApiReleaseResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateWorkspaceApiRelease + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceApiRelease() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApiRelease.json + // this example is just showing the usage of "WorkspaceApiRelease_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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "a1"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiReleaseResource + ServiceWorkspaceApiReleaseCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiReleases(); + + // 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/workspaces/wks1/apis/a1"), + Notes = "yahooagain", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, releaseId, data); + ServiceWorkspaceApiReleaseResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiReleaseResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiReleaseResource.cs new file mode 100644 index 000000000000..efba0c21c672 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiReleaseResource.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiReleaseResource + { + // ApiManagementHeadWorkspaceApiRelease + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceApiRelease() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceApiRelease.json + // this example is just showing the usage of "WorkspaceApiRelease_GetEntityTag" 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 ServiceWorkspaceApiReleaseResource created on azure + // for more information of creating ServiceWorkspaceApiReleaseResource, please refer to the document of ServiceWorkspaceApiReleaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "a1"; + string releaseId = "5a7cb545298324c53224a799"; + ResourceIdentifier serviceWorkspaceApiReleaseResourceId = ServiceWorkspaceApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + ServiceWorkspaceApiReleaseResource serviceWorkspaceApiRelease = client.GetServiceWorkspaceApiReleaseResource(serviceWorkspaceApiReleaseResourceId); + + // invoke the operation + bool result = await serviceWorkspaceApiRelease.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiRelease + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiRelease() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiRelease.json + // this example is just showing the usage of "WorkspaceApiRelease_Get" 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 ServiceWorkspaceApiReleaseResource created on azure + // for more information of creating ServiceWorkspaceApiReleaseResource, please refer to the document of ServiceWorkspaceApiReleaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "a1"; + string releaseId = "5a7cb545298324c53224a799"; + ResourceIdentifier serviceWorkspaceApiReleaseResourceId = ServiceWorkspaceApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + ServiceWorkspaceApiReleaseResource serviceWorkspaceApiRelease = client.GetServiceWorkspaceApiReleaseResource(serviceWorkspaceApiReleaseResourceId); + + // invoke the operation + ServiceWorkspaceApiReleaseResource result = await serviceWorkspaceApiRelease.GetAsync(); + + // 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}"); + } + + // ApiManagementUpdateWorkspaceApiRelease + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspaceApiRelease() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspaceApiRelease.json + // this example is just showing the usage of "WorkspaceApiRelease_Update" 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 ServiceWorkspaceApiReleaseResource created on azure + // for more information of creating ServiceWorkspaceApiReleaseResource, please refer to the document of ServiceWorkspaceApiReleaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "a1"; + string releaseId = "testrev"; + ResourceIdentifier serviceWorkspaceApiReleaseResourceId = ServiceWorkspaceApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + ServiceWorkspaceApiReleaseResource serviceWorkspaceApiRelease = client.GetServiceWorkspaceApiReleaseResource(serviceWorkspaceApiReleaseResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + ApiReleaseData data = new ApiReleaseData() + { + ApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/a1"), + Notes = "yahooagain", + }; + ServiceWorkspaceApiReleaseResource result = await serviceWorkspaceApiRelease.UpdateAsync(ifMatch, data); + + // 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}"); + } + + // ApiManagementDeleteWorkspaceApiRelease + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceApiRelease() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceApiRelease.json + // this example is just showing the usage of "WorkspaceApiRelease_Delete" 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 ServiceWorkspaceApiReleaseResource created on azure + // for more information of creating ServiceWorkspaceApiReleaseResource, please refer to the document of ServiceWorkspaceApiReleaseResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "5a5fcc09124a7fa9b89f2f1d"; + string releaseId = "testrev"; + ResourceIdentifier serviceWorkspaceApiReleaseResourceId = ServiceWorkspaceApiReleaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + ServiceWorkspaceApiReleaseResource serviceWorkspaceApiRelease = client.GetServiceWorkspaceApiReleaseResource(serviceWorkspaceApiReleaseResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceApiRelease.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiResource.cs new file mode 100644 index 000000000000..03b317797b0f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiResource.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiResource + { + // ApiManagementHeadWorkspaceApi + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceApi() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceApi.json + // this example is just showing the usage of "WorkspaceApi_GetEntityTag" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // invoke the operation + bool result = await serviceWorkspaceApi.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiContract + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiContract() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiContract.json + // this example is just showing the usage of "WorkspaceApi_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d1f7558aa04f15146d9d8a"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // invoke the operation + ServiceWorkspaceApiResource result = await serviceWorkspaceApi.GetAsync(); + + // 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}"); + } + + // ApiManagementGetWorkspaceApiRevision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiRevision() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiRevision.json + // this example is just showing the usage of "WorkspaceApi_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "echo-api;rev=3"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // invoke the operation + ServiceWorkspaceApiResource result = await serviceWorkspaceApi.GetAsync(); + + // 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}"); + } + + // ApiManagementUpdateWorkspaceApi + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspaceApi() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspaceApi.json + // this example is just showing the usage of "WorkspaceApi_Update" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "echo-api"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + ApiUpdateContract apiUpdateContract = new ApiUpdateContract() + { + DisplayName = "Echo API New", + ServiceUri = new Uri("http://echoapi.cloudapp.net/api2"), + Path = "newecho", + }; + ServiceWorkspaceApiResource result = await serviceWorkspaceApi.UpdateAsync(ifMatch, apiUpdateContract); + + // 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}"); + } + + // ApiManagementDeleteWorkspaceApi + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceApi() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceApi.json + // this example is just showing the usage of "WorkspaceApi_Delete" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "echo-api"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceApi.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementListWorkspaceApiRevisions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWorkspaceApiRevisionsByService_ApiManagementListWorkspaceApiRevisions() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceApiRevisions.json + // this example is just showing the usage of "WorkspaceApiRevision_ListByService" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // invoke the operation and iterate over the result + await foreach (ApiRevisionContract item in serviceWorkspaceApi.GetWorkspaceApiRevisionsByServiceAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiSchemaCollection.cs new file mode 100644 index 000000000000..61160d8a6eca --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiSchemaCollection.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiSchemaCollection + { + // ApiManagementListWorkspaceApiSchemas + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceApiSchemas() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceApiSchemas.json + // this example is just showing the usage of "WorkspaceApiSchema_ListByApi" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "59d5b28d1f7fab116c282650"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiSchemaResource + ServiceWorkspaceApiSchemaCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiSchemas(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceApiSchemaResource item in collection.GetAllAsync()) + { + // the variable item 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 + ApiSchemaData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceApiSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiSchema.json + // this example is just showing the usage of "WorkspaceApiSchema_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiSchemaResource + ServiceWorkspaceApiSchemaCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiSchemas(); + + // invoke the operation + string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; + ServiceWorkspaceApiSchemaResource result = await collection.GetAsync(schemaId); + + // 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 + ApiSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceApiSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceApiSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiSchema.json + // this example is just showing the usage of "WorkspaceApiSchema_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiSchemaResource + ServiceWorkspaceApiSchemaCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiSchemas(); + + // invoke the operation + string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; + bool result = await collection.ExistsAsync(schemaId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceApiSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiSchema.json + // this example is just showing the usage of "WorkspaceApiSchema_Get" 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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiSchemaResource + ServiceWorkspaceApiSchemaCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiSchemas(); + + // invoke the operation + string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; + NullableResponse response = await collection.GetIfExistsAsync(schemaId); + ServiceWorkspaceApiSchemaResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ApiSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceApiSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceApiSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApiSchema.json + // this example is just showing the usage of "WorkspaceApiSchema_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 ServiceWorkspaceApiResource created on azure + // for more information of creating ServiceWorkspaceApiResource, please refer to the document of ServiceWorkspaceApiResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + ResourceIdentifier serviceWorkspaceApiResourceId = ServiceWorkspaceApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + ServiceWorkspaceApiResource serviceWorkspaceApi = client.GetServiceWorkspaceApiResource(serviceWorkspaceApiResourceId); + + // get the collection of this ServiceWorkspaceApiSchemaResource + ServiceWorkspaceApiSchemaCollection collection = serviceWorkspaceApi.GetServiceWorkspaceApiSchemas(); + + // invoke the operation + string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; + ApiSchemaData data = new ApiSchemaData() + { + ContentType = "application/vnd.ms-azure-apim.xsd+xml", + Value = "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaId, data); + ServiceWorkspaceApiSchemaResource 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 + ApiSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiSchemaResource.cs new file mode 100644 index 000000000000..290cf24815be --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiSchemaResource.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiSchemaResource + { + // ApiManagementHeadWorkspaceApiSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceApiSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceApiSchema.json + // this example is just showing the usage of "WorkspaceApiSchema_GetEntityTag" 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 ServiceWorkspaceApiSchemaResource created on azure + // for more information of creating ServiceWorkspaceApiSchemaResource, please refer to the document of ServiceWorkspaceApiSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "57d1f7558aa04f15146d9d8a"; + string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; + ResourceIdentifier serviceWorkspaceApiSchemaResourceId = ServiceWorkspaceApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + ServiceWorkspaceApiSchemaResource serviceWorkspaceApiSchema = client.GetServiceWorkspaceApiSchemaResource(serviceWorkspaceApiSchemaResourceId); + + // invoke the operation + bool result = await serviceWorkspaceApiSchema.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiSchema.json + // this example is just showing the usage of "WorkspaceApiSchema_Get" 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 ServiceWorkspaceApiSchemaResource created on azure + // for more information of creating ServiceWorkspaceApiSchemaResource, please refer to the document of ServiceWorkspaceApiSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; + ResourceIdentifier serviceWorkspaceApiSchemaResourceId = ServiceWorkspaceApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + ServiceWorkspaceApiSchemaResource serviceWorkspaceApiSchema = client.GetServiceWorkspaceApiSchemaResource(serviceWorkspaceApiSchemaResourceId); + + // invoke the operation + ServiceWorkspaceApiSchemaResource result = await serviceWorkspaceApiSchema.GetAsync(); + + // 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 + ApiSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceApiSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceApiSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApiSchema.json + // this example is just showing the usage of "WorkspaceApiSchema_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 ServiceWorkspaceApiSchemaResource created on azure + // for more information of creating ServiceWorkspaceApiSchemaResource, please refer to the document of ServiceWorkspaceApiSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "59d6bb8f1f7fab13dc67ec9b"; + string schemaId = "ec12520d-9d48-4e7b-8f39-698ca2ac63f1"; + ResourceIdentifier serviceWorkspaceApiSchemaResourceId = ServiceWorkspaceApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + ServiceWorkspaceApiSchemaResource serviceWorkspaceApiSchema = client.GetServiceWorkspaceApiSchemaResource(serviceWorkspaceApiSchemaResourceId); + + // invoke the operation + ApiSchemaData data = new ApiSchemaData() + { + ContentType = "application/vnd.ms-azure-apim.xsd+xml", + Value = "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", + }; + ArmOperation lro = await serviceWorkspaceApiSchema.UpdateAsync(WaitUntil.Completed, data); + ServiceWorkspaceApiSchemaResource 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 + ApiSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceApiSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceApiSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceApiSchema.json + // this example is just showing the usage of "WorkspaceApiSchema_Delete" 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 ServiceWorkspaceApiSchemaResource created on azure + // for more information of creating ServiceWorkspaceApiSchemaResource, please refer to the document of ServiceWorkspaceApiSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string apiId = "59d5b28d1f7fab116c282650"; + string schemaId = "59d5b28e1f7fab116402044e"; + ResourceIdentifier serviceWorkspaceApiSchemaResourceId = ServiceWorkspaceApiSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + ServiceWorkspaceApiSchemaResource serviceWorkspaceApiSchema = client.GetServiceWorkspaceApiSchemaResource(serviceWorkspaceApiSchemaResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceApiSchema.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiVersionSetCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiVersionSetCollection.cs new file mode 100644 index 000000000000..532d243547fb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiVersionSetCollection.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiVersionSetCollection + { + // ApiManagementListWorkspaceApiVersionSets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceApiVersionSets() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceApiVersionSets.json + // this example is just showing the usage of "WorkspaceApiVersionSet_ListByService" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiVersionSetResource + ServiceWorkspaceApiVersionSetCollection collection = workspaceContract.GetServiceWorkspaceApiVersionSets(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceApiVersionSetResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceApiVersionSet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiVersionSet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiVersionSet.json + // this example is just showing the usage of "WorkspaceApiVersionSet_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiVersionSetResource + ServiceWorkspaceApiVersionSetCollection collection = workspaceContract.GetServiceWorkspaceApiVersionSets(); + + // invoke the operation + string versionSetId = "vs1"; + ServiceWorkspaceApiVersionSetResource result = await collection.GetAsync(versionSetId); + + // 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}"); + } + + // ApiManagementGetWorkspaceApiVersionSet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceApiVersionSet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiVersionSet.json + // this example is just showing the usage of "WorkspaceApiVersionSet_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiVersionSetResource + ServiceWorkspaceApiVersionSetCollection collection = workspaceContract.GetServiceWorkspaceApiVersionSets(); + + // invoke the operation + string versionSetId = "vs1"; + bool result = await collection.ExistsAsync(versionSetId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiVersionSet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceApiVersionSet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiVersionSet.json + // this example is just showing the usage of "WorkspaceApiVersionSet_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiVersionSetResource + ServiceWorkspaceApiVersionSetCollection collection = workspaceContract.GetServiceWorkspaceApiVersionSets(); + + // invoke the operation + string versionSetId = "vs1"; + NullableResponse response = await collection.GetIfExistsAsync(versionSetId); + ServiceWorkspaceApiVersionSetResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateWorkspaceApiVersionSet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceApiVersionSet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceApiVersionSet.json + // this example is just showing the usage of "WorkspaceApiVersionSet_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceApiVersionSetResource + ServiceWorkspaceApiVersionSetCollection collection = workspaceContract.GetServiceWorkspaceApiVersionSets(); + + // invoke the operation + string versionSetId = "api1"; + ApiVersionSetData data = new ApiVersionSetData() + { + Description = "Version configuration", + DisplayName = "api set 1", + VersioningScheme = VersioningScheme.Segment, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, versionSetId, data); + ServiceWorkspaceApiVersionSetResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiVersionSetResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiVersionSetResource.cs new file mode 100644 index 000000000000..3e1fd95e7b28 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceApiVersionSetResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceApiVersionSetResource + { + // ApiManagementHeadWorkspaceApiVersionSet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceApiVersionSet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceApiVersionSet.json + // this example is just showing the usage of "WorkspaceApiVersionSet_GetEntityTag" 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 ServiceWorkspaceApiVersionSetResource created on azure + // for more information of creating ServiceWorkspaceApiVersionSetResource, please refer to the document of ServiceWorkspaceApiVersionSetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string versionSetId = "vs1"; + ResourceIdentifier serviceWorkspaceApiVersionSetResourceId = ServiceWorkspaceApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + ServiceWorkspaceApiVersionSetResource serviceWorkspaceApiVersionSet = client.GetServiceWorkspaceApiVersionSetResource(serviceWorkspaceApiVersionSetResourceId); + + // invoke the operation + bool result = await serviceWorkspaceApiVersionSet.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceApiVersionSet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceApiVersionSet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceApiVersionSet.json + // this example is just showing the usage of "WorkspaceApiVersionSet_Get" 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 ServiceWorkspaceApiVersionSetResource created on azure + // for more information of creating ServiceWorkspaceApiVersionSetResource, please refer to the document of ServiceWorkspaceApiVersionSetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string versionSetId = "vs1"; + ResourceIdentifier serviceWorkspaceApiVersionSetResourceId = ServiceWorkspaceApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + ServiceWorkspaceApiVersionSetResource serviceWorkspaceApiVersionSet = client.GetServiceWorkspaceApiVersionSetResource(serviceWorkspaceApiVersionSetResourceId); + + // invoke the operation + ServiceWorkspaceApiVersionSetResource result = await serviceWorkspaceApiVersionSet.GetAsync(); + + // 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}"); + } + + // ApiManagementUpdateWorkspaceApiVersionSet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspaceApiVersionSet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspaceApiVersionSet.json + // this example is just showing the usage of "WorkspaceApiVersionSet_Update" 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 ServiceWorkspaceApiVersionSetResource created on azure + // for more information of creating ServiceWorkspaceApiVersionSetResource, please refer to the document of ServiceWorkspaceApiVersionSetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string versionSetId = "vs1"; + ResourceIdentifier serviceWorkspaceApiVersionSetResourceId = ServiceWorkspaceApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + ServiceWorkspaceApiVersionSetResource serviceWorkspaceApiVersionSet = client.GetServiceWorkspaceApiVersionSetResource(serviceWorkspaceApiVersionSetResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + ApiVersionSetUpdateParameters apiVersionSetUpdateParameters = new ApiVersionSetUpdateParameters() + { + Description = "Version configuration", + DisplayName = "api set 1", + VersioningScheme = VersioningScheme.Segment, + }; + ServiceWorkspaceApiVersionSetResource result = await serviceWorkspaceApiVersionSet.UpdateAsync(ifMatch, apiVersionSetUpdateParameters); + + // 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}"); + } + + // ApiManagementDeleteWorkspaceApiVersionSet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceApiVersionSet() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceApiVersionSet.json + // this example is just showing the usage of "WorkspaceApiVersionSet_Delete" 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 ServiceWorkspaceApiVersionSetResource created on azure + // for more information of creating ServiceWorkspaceApiVersionSetResource, please refer to the document of ServiceWorkspaceApiVersionSetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string versionSetId = "a1"; + ResourceIdentifier serviceWorkspaceApiVersionSetResourceId = ServiceWorkspaceApiVersionSetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + ServiceWorkspaceApiVersionSetResource serviceWorkspaceApiVersionSet = client.GetServiceWorkspaceApiVersionSetResource(serviceWorkspaceApiVersionSetResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceApiVersionSet.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceGroupCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceGroupCollection.cs new file mode 100644 index 000000000000..fc18bf255848 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceGroupCollection.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceGroupCollection + { + // ApiManagementListWorkspaceGroups + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceGroups() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceGroups.json + // this example is just showing the usage of "WorkspaceGroup_ListByService" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceGroupResource + ServiceWorkspaceGroupCollection collection = workspaceContract.GetServiceWorkspaceGroups(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceGroupResource item in collection.GetAllAsync()) + { + // the variable item 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 + ApiManagementGroupData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceGroup() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceGroup.json + // this example is just showing the usage of "WorkspaceGroup_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceGroupResource + ServiceWorkspaceGroupCollection collection = workspaceContract.GetServiceWorkspaceGroups(); + + // invoke the operation + string groupId = "59306a29e4bbd510dc24e5f9"; + ServiceWorkspaceGroupResource result = await collection.GetAsync(groupId); + + // 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 + ApiManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceGroup() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceGroup.json + // this example is just showing the usage of "WorkspaceGroup_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceGroupResource + ServiceWorkspaceGroupCollection collection = workspaceContract.GetServiceWorkspaceGroups(); + + // invoke the operation + string groupId = "59306a29e4bbd510dc24e5f9"; + bool result = await collection.ExistsAsync(groupId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceGroup() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceGroup.json + // this example is just showing the usage of "WorkspaceGroup_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceGroupResource + ServiceWorkspaceGroupCollection collection = workspaceContract.GetServiceWorkspaceGroups(); + + // invoke the operation + string groupId = "59306a29e4bbd510dc24e5f9"; + NullableResponse response = await collection.GetIfExistsAsync(groupId); + ServiceWorkspaceGroupResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ApiManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceGroup() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceGroup.json + // this example is just showing the usage of "WorkspaceGroup_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceGroupResource + ServiceWorkspaceGroupCollection collection = workspaceContract.GetServiceWorkspaceGroups(); + + // invoke the operation + string groupId = "tempgroup"; + GroupCreateParameters groupCreateParameters = new GroupCreateParameters() + { + DisplayName = "temp group", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, groupId, groupCreateParameters); + ServiceWorkspaceGroupResource 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 + ApiManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceGroupExternal + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceGroupExternal() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceGroupExternal.json + // this example is just showing the usage of "WorkspaceGroup_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceGroupResource + ServiceWorkspaceGroupCollection collection = workspaceContract.GetServiceWorkspaceGroups(); + + // invoke the operation + string groupId = "aadGroup"; + GroupCreateParameters groupCreateParameters = new GroupCreateParameters() + { + DisplayName = "NewGroup (samiraad.onmicrosoft.com)", + Description = "new group to test", + ApiManagementGroupType = ApiManagementGroupType.External, + ExternalId = "aad://samiraad.onmicrosoft.com/groups/83cf2753-5831-4675-bc0e-2f8dc067c58d", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, groupId, groupCreateParameters); + ServiceWorkspaceGroupResource 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 + ApiManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceGroupResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceGroupResource.cs new file mode 100644 index 000000000000..2b109efa927f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceGroupResource.cs @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceGroupResource + { + // ApiManagementHeadWorkspaceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceGroup() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceGroup.json + // this example is just showing the usage of "WorkspaceGroup_GetEntityTag" 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 ServiceWorkspaceGroupResource created on azure + // for more information of creating ServiceWorkspaceGroupResource, please refer to the document of ServiceWorkspaceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string groupId = "59306a29e4bbd510dc24e5f9"; + ResourceIdentifier serviceWorkspaceGroupResourceId = ServiceWorkspaceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + ServiceWorkspaceGroupResource serviceWorkspaceGroup = client.GetServiceWorkspaceGroupResource(serviceWorkspaceGroupResourceId); + + // invoke the operation + bool result = await serviceWorkspaceGroup.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceGroup() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceGroup.json + // this example is just showing the usage of "WorkspaceGroup_Get" 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 ServiceWorkspaceGroupResource created on azure + // for more information of creating ServiceWorkspaceGroupResource, please refer to the document of ServiceWorkspaceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string groupId = "59306a29e4bbd510dc24e5f9"; + ResourceIdentifier serviceWorkspaceGroupResourceId = ServiceWorkspaceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + ServiceWorkspaceGroupResource serviceWorkspaceGroup = client.GetServiceWorkspaceGroupResource(serviceWorkspaceGroupResourceId); + + // invoke the operation + ServiceWorkspaceGroupResource result = await serviceWorkspaceGroup.GetAsync(); + + // 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 + ApiManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementUpdateWorkspaceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspaceGroup() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspaceGroup.json + // this example is just showing the usage of "WorkspaceGroup_Update" 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 ServiceWorkspaceGroupResource created on azure + // for more information of creating ServiceWorkspaceGroupResource, please refer to the document of ServiceWorkspaceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string groupId = "tempgroup"; + ResourceIdentifier serviceWorkspaceGroupResourceId = ServiceWorkspaceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + ServiceWorkspaceGroupResource serviceWorkspaceGroup = client.GetServiceWorkspaceGroupResource(serviceWorkspaceGroupResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + GroupUpdateParameters groupUpdateParameters = new GroupUpdateParameters() + { + DisplayName = "temp group", + }; + ServiceWorkspaceGroupResource result = await serviceWorkspaceGroup.UpdateAsync(ifMatch, groupUpdateParameters); + + // 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 + ApiManagementGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceGroup() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceGroup.json + // this example is just showing the usage of "WorkspaceGroup_Delete" 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 ServiceWorkspaceGroupResource created on azure + // for more information of creating ServiceWorkspaceGroupResource, please refer to the document of ServiceWorkspaceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string groupId = "aadGroup"; + ResourceIdentifier serviceWorkspaceGroupResourceId = ServiceWorkspaceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + ServiceWorkspaceGroupResource serviceWorkspaceGroup = client.GetServiceWorkspaceGroupResource(serviceWorkspaceGroupResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceGroup.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementListWorkspaceGroupUsers + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWorkspaceGroupUsers_ApiManagementListWorkspaceGroupUsers() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceGroupUsers.json + // this example is just showing the usage of "WorkspaceGroupUser_List" 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 ServiceWorkspaceGroupResource created on azure + // for more information of creating ServiceWorkspaceGroupResource, please refer to the document of ServiceWorkspaceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string groupId = "57d2ef278aa04f0888cba3f3"; + ResourceIdentifier serviceWorkspaceGroupResourceId = ServiceWorkspaceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + ServiceWorkspaceGroupResource serviceWorkspaceGroup = client.GetServiceWorkspaceGroupResource(serviceWorkspaceGroupResourceId); + + // invoke the operation and iterate over the result + await foreach (ApiManagementUserResource item in serviceWorkspaceGroup.GetWorkspaceGroupUsersAsync()) + { + // the variable item 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 + UserContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementHeadWorkspaceGroupUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckEntityExistsWorkspaceGroupUser_ApiManagementHeadWorkspaceGroupUser() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceGroupUser.json + // this example is just showing the usage of "WorkspaceGroupUser_CheckEntityExists" 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 ServiceWorkspaceGroupResource created on azure + // for more information of creating ServiceWorkspaceGroupResource, please refer to the document of ServiceWorkspaceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string groupId = "59306a29e4bbd510dc24e5f9"; + ResourceIdentifier serviceWorkspaceGroupResourceId = ServiceWorkspaceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + ServiceWorkspaceGroupResource serviceWorkspaceGroup = client.GetServiceWorkspaceGroupResource(serviceWorkspaceGroupResourceId); + + // invoke the operation + string userId = "5931a75ae4bbd512a88c680b"; + bool result = await serviceWorkspaceGroup.CheckEntityExistsWorkspaceGroupUserAsync(userId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementCreateWorkspaceGroupUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateWorkspaceGroupUser_ApiManagementCreateWorkspaceGroupUser() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceGroupUser.json + // this example is just showing the usage of "WorkspaceGroupUser_Create" 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 ServiceWorkspaceGroupResource created on azure + // for more information of creating ServiceWorkspaceGroupResource, please refer to the document of ServiceWorkspaceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string groupId = "tempgroup"; + ResourceIdentifier serviceWorkspaceGroupResourceId = ServiceWorkspaceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + ServiceWorkspaceGroupResource serviceWorkspaceGroup = client.GetServiceWorkspaceGroupResource(serviceWorkspaceGroupResourceId); + + // invoke the operation + string userId = "59307d350af58404d8a26300"; + ApiManagementUserResource result = await serviceWorkspaceGroup.CreateWorkspaceGroupUserAsync(userId); + + // 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 + UserContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceGroupUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task DeleteWorkspaceGroupUser_ApiManagementDeleteWorkspaceGroupUser() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceGroupUser.json + // this example is just showing the usage of "WorkspaceGroupUser_Delete" 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 ServiceWorkspaceGroupResource created on azure + // for more information of creating ServiceWorkspaceGroupResource, please refer to the document of ServiceWorkspaceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string groupId = "templategroup"; + ResourceIdentifier serviceWorkspaceGroupResourceId = ServiceWorkspaceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + ServiceWorkspaceGroupResource serviceWorkspaceGroup = client.GetServiceWorkspaceGroupResource(serviceWorkspaceGroupResourceId); + + // invoke the operation + string userId = "59307d350af58404d8a26300"; + await serviceWorkspaceGroup.DeleteWorkspaceGroupUserAsync(userId); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNamedValueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNamedValueCollection.cs new file mode 100644 index 000000000000..152c1e0845fb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNamedValueCollection.cs @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceNamedValueCollection + { + // ApiManagementListWorkspaceNamedValues + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceNamedValues() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceNamedValues.json + // this example is just showing the usage of "WorkspaceNamedValue_ListByService" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNamedValueResource + ServiceWorkspaceNamedValueCollection collection = workspaceContract.GetServiceWorkspaceNamedValues(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceNamedValueResource item in collection.GetAllAsync()) + { + // the variable item 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 + ApiManagementNamedValueData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNamedValue.json + // this example is just showing the usage of "WorkspaceNamedValue_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNamedValueResource + ServiceWorkspaceNamedValueCollection collection = workspaceContract.GetServiceWorkspaceNamedValues(); + + // invoke the operation + string namedValueId = "testarmTemplateproperties2"; + ServiceWorkspaceNamedValueResource result = await collection.GetAsync(namedValueId); + + // 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNamedValue.json + // this example is just showing the usage of "WorkspaceNamedValue_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNamedValueResource + ServiceWorkspaceNamedValueCollection collection = workspaceContract.GetServiceWorkspaceNamedValues(); + + // invoke the operation + string namedValueId = "testarmTemplateproperties2"; + bool result = await collection.ExistsAsync(namedValueId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNamedValue.json + // this example is just showing the usage of "WorkspaceNamedValue_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNamedValueResource + ServiceWorkspaceNamedValueCollection collection = workspaceContract.GetServiceWorkspaceNamedValues(); + + // invoke the operation + string namedValueId = "testarmTemplateproperties2"; + NullableResponse response = await collection.GetIfExistsAsync(namedValueId); + ServiceWorkspaceNamedValueResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementGetWorkspaceNamedValueWithKeyVault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceNamedValueWithKeyVault() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNamedValueWithKeyVault.json + // this example is just showing the usage of "WorkspaceNamedValue_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNamedValueResource + ServiceWorkspaceNamedValueCollection collection = workspaceContract.GetServiceWorkspaceNamedValues(); + + // invoke the operation + string namedValueId = "testprop6"; + ServiceWorkspaceNamedValueResource result = await collection.GetAsync(namedValueId); + + // 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceNamedValueWithKeyVault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceNamedValueWithKeyVault() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNamedValueWithKeyVault.json + // this example is just showing the usage of "WorkspaceNamedValue_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNamedValueResource + ServiceWorkspaceNamedValueCollection collection = workspaceContract.GetServiceWorkspaceNamedValues(); + + // invoke the operation + string namedValueId = "testprop6"; + bool result = await collection.ExistsAsync(namedValueId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceNamedValueWithKeyVault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceNamedValueWithKeyVault() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNamedValueWithKeyVault.json + // this example is just showing the usage of "WorkspaceNamedValue_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNamedValueResource + ServiceWorkspaceNamedValueCollection collection = workspaceContract.GetServiceWorkspaceNamedValues(); + + // invoke the operation + string namedValueId = "testprop6"; + NullableResponse response = await collection.GetIfExistsAsync(namedValueId); + ServiceWorkspaceNamedValueResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceNamedValue.json + // this example is just showing the usage of "WorkspaceNamedValue_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNamedValueResource + ServiceWorkspaceNamedValueCollection collection = workspaceContract.GetServiceWorkspaceNamedValues(); + + // invoke the operation + string namedValueId = "testprop2"; + NamedValueCreateContract namedValueCreateContract = new NamedValueCreateContract() + { + Tags = +{ +"foo","bar" +}, + IsSecret = false, + DisplayName = "prop3name", + Value = "propValue", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namedValueId, namedValueCreateContract); + ServiceWorkspaceNamedValueResource 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceNamedValueWithKeyVault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceNamedValueWithKeyVault() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceNamedValueWithKeyVault.json + // this example is just showing the usage of "WorkspaceNamedValue_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNamedValueResource + ServiceWorkspaceNamedValueCollection collection = workspaceContract.GetServiceWorkspaceNamedValues(); + + // invoke the operation + string namedValueId = "testprop6"; + NamedValueCreateContract namedValueCreateContract = new NamedValueCreateContract() + { + Tags = +{ +"foo","bar" +}, + IsSecret = true, + DisplayName = "prop6namekv", + KeyVault = new KeyVaultContractCreateProperties() + { + SecretIdentifier = "https://contoso.vault.azure.net/secrets/aadSecret", + IdentityClientId = "ceaa6b06-c00f-43ef-99ac-f53d1fe876a0", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namedValueId, namedValueCreateContract); + ServiceWorkspaceNamedValueResource 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNamedValueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNamedValueResource.cs new file mode 100644 index 000000000000..ef1ff9104632 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNamedValueResource.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceNamedValueResource + { + // ApiManagementHeadWorkspaceNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceNamedValue.json + // this example is just showing the usage of "WorkspaceNamedValue_GetEntityTag" 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 ServiceWorkspaceNamedValueResource created on azure + // for more information of creating ServiceWorkspaceNamedValueResource, please refer to the document of ServiceWorkspaceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string namedValueId = "testarmTemplateproperties2"; + ResourceIdentifier serviceWorkspaceNamedValueResourceId = ServiceWorkspaceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + ServiceWorkspaceNamedValueResource serviceWorkspaceNamedValue = client.GetServiceWorkspaceNamedValueResource(serviceWorkspaceNamedValueResourceId); + + // invoke the operation + bool result = await serviceWorkspaceNamedValue.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNamedValue.json + // this example is just showing the usage of "WorkspaceNamedValue_Get" 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 ServiceWorkspaceNamedValueResource created on azure + // for more information of creating ServiceWorkspaceNamedValueResource, please refer to the document of ServiceWorkspaceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string namedValueId = "testarmTemplateproperties2"; + ResourceIdentifier serviceWorkspaceNamedValueResourceId = ServiceWorkspaceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + ServiceWorkspaceNamedValueResource serviceWorkspaceNamedValue = client.GetServiceWorkspaceNamedValueResource(serviceWorkspaceNamedValueResourceId); + + // invoke the operation + ServiceWorkspaceNamedValueResource result = await serviceWorkspaceNamedValue.GetAsync(); + + // 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceNamedValueWithKeyVault + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceNamedValueWithKeyVault() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNamedValueWithKeyVault.json + // this example is just showing the usage of "WorkspaceNamedValue_Get" 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 ServiceWorkspaceNamedValueResource created on azure + // for more information of creating ServiceWorkspaceNamedValueResource, please refer to the document of ServiceWorkspaceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string namedValueId = "testprop6"; + ResourceIdentifier serviceWorkspaceNamedValueResourceId = ServiceWorkspaceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + ServiceWorkspaceNamedValueResource serviceWorkspaceNamedValue = client.GetServiceWorkspaceNamedValueResource(serviceWorkspaceNamedValueResourceId); + + // invoke the operation + ServiceWorkspaceNamedValueResource result = await serviceWorkspaceNamedValue.GetAsync(); + + // 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementUpdateWorkspaceNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspaceNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspaceNamedValue.json + // this example is just showing the usage of "WorkspaceNamedValue_Update" 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 ServiceWorkspaceNamedValueResource created on azure + // for more information of creating ServiceWorkspaceNamedValueResource, please refer to the document of ServiceWorkspaceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string namedValueId = "testprop2"; + ResourceIdentifier serviceWorkspaceNamedValueResourceId = ServiceWorkspaceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + ServiceWorkspaceNamedValueResource serviceWorkspaceNamedValue = client.GetServiceWorkspaceNamedValueResource(serviceWorkspaceNamedValueResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + NamedValueUpdateParameters namedValueUpdateParameters = new NamedValueUpdateParameters() + { + Tags = +{ +"foo","bar2" +}, + IsSecret = false, + DisplayName = "prop3name", + Value = "propValue", + }; + ArmOperation lro = await serviceWorkspaceNamedValue.UpdateAsync(WaitUntil.Completed, ifMatch, namedValueUpdateParameters); + ServiceWorkspaceNamedValueResource 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceNamedValue.json + // this example is just showing the usage of "WorkspaceNamedValue_Delete" 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 ServiceWorkspaceNamedValueResource created on azure + // for more information of creating ServiceWorkspaceNamedValueResource, please refer to the document of ServiceWorkspaceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string namedValueId = "testprop2"; + ResourceIdentifier serviceWorkspaceNamedValueResourceId = ServiceWorkspaceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + ServiceWorkspaceNamedValueResource serviceWorkspaceNamedValue = client.GetServiceWorkspaceNamedValueResource(serviceWorkspaceNamedValueResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceNamedValue.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementWorkspaceNamedValueListValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetValue_ApiManagementWorkspaceNamedValueListValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementWorkspaceNamedValueListValue.json + // this example is just showing the usage of "WorkspaceNamedValue_ListValue" 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 ServiceWorkspaceNamedValueResource created on azure + // for more information of creating ServiceWorkspaceNamedValueResource, please refer to the document of ServiceWorkspaceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string namedValueId = "testarmTemplateproperties2"; + ResourceIdentifier serviceWorkspaceNamedValueResourceId = ServiceWorkspaceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + ServiceWorkspaceNamedValueResource serviceWorkspaceNamedValue = client.GetServiceWorkspaceNamedValueResource(serviceWorkspaceNamedValueResourceId); + + // invoke the operation + NamedValueSecretContract result = await serviceWorkspaceNamedValue.GetValueAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementRefreshWorkspaceNamedValue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RefreshSecret_ApiManagementRefreshWorkspaceNamedValue() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementRefreshWorkspaceNamedValue.json + // this example is just showing the usage of "WorkspaceNamedValue_RefreshSecret" 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 ServiceWorkspaceNamedValueResource created on azure + // for more information of creating ServiceWorkspaceNamedValueResource, please refer to the document of ServiceWorkspaceNamedValueResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string namedValueId = "testprop2"; + ResourceIdentifier serviceWorkspaceNamedValueResourceId = ServiceWorkspaceNamedValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + ServiceWorkspaceNamedValueResource serviceWorkspaceNamedValue = client.GetServiceWorkspaceNamedValueResource(serviceWorkspaceNamedValueResourceId); + + // invoke the operation + ArmOperation lro = await serviceWorkspaceNamedValue.RefreshSecretAsync(WaitUntil.Completed); + ServiceWorkspaceNamedValueResource 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 + ApiManagementNamedValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNotificationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNotificationCollection.cs new file mode 100644 index 000000000000..71e49e158f7a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNotificationCollection.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceNotificationCollection + { + // ApiManagementListWorkspaceNotifications + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceNotifications() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceNotifications.json + // this example is just showing the usage of "WorkspaceNotification_ListByService" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNotificationResource + ServiceWorkspaceNotificationCollection collection = workspaceContract.GetServiceWorkspaceNotifications(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceNotificationResource item in collection.GetAllAsync()) + { + // the variable item 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 + ApiManagementNotificationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceNotification + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceNotification() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNotification.json + // this example is just showing the usage of "WorkspaceNotification_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNotificationResource + ServiceWorkspaceNotificationCollection collection = workspaceContract.GetServiceWorkspaceNotifications(); + + // invoke the operation + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ServiceWorkspaceNotificationResource result = await collection.GetAsync(notificationName); + + // 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 + ApiManagementNotificationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceNotification + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceNotification() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNotification.json + // this example is just showing the usage of "WorkspaceNotification_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNotificationResource + ServiceWorkspaceNotificationCollection collection = workspaceContract.GetServiceWorkspaceNotifications(); + + // invoke the operation + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + bool result = await collection.ExistsAsync(notificationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceNotification + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceNotification() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNotification.json + // this example is just showing the usage of "WorkspaceNotification_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNotificationResource + ServiceWorkspaceNotificationCollection collection = workspaceContract.GetServiceWorkspaceNotifications(); + + // invoke the operation + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + NullableResponse response = await collection.GetIfExistsAsync(notificationName); + ServiceWorkspaceNotificationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ApiManagementNotificationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceNotification + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceNotification() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceNotification.json + // this example is just showing the usage of "WorkspaceNotification_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceNotificationResource + ServiceWorkspaceNotificationCollection collection = workspaceContract.GetServiceWorkspaceNotifications(); + + // invoke the operation + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, notificationName); + ServiceWorkspaceNotificationResource 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 + ApiManagementNotificationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNotificationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNotificationResource.cs new file mode 100644 index 000000000000..6bffc4810e1e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceNotificationResource.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceNotificationResource + { + // ApiManagementGetWorkspaceNotification + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceNotification() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceNotification.json + // this example is just showing the usage of "WorkspaceNotification_Get" 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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation + ServiceWorkspaceNotificationResource result = await serviceWorkspaceNotification.GetAsync(); + + // 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 + ApiManagementNotificationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceNotification + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceNotification() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceNotification.json + // this example is just showing the usage of "WorkspaceNotification_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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation + ArmOperation lro = await serviceWorkspaceNotification.UpdateAsync(WaitUntil.Completed); + ServiceWorkspaceNotificationResource 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 + ApiManagementNotificationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementListWorkspaceNotificationRecipientUsers + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWorkspaceNotificationRecipientUsersByNotification_ApiManagementListWorkspaceNotificationRecipientUsers() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceNotificationRecipientUsers.json + // this example is just showing the usage of "WorkspaceNotificationRecipientUser_ListByNotification" 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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation and iterate over the result + await foreach (RecipientUserContract item in serviceWorkspaceNotification.GetWorkspaceNotificationRecipientUsersByNotificationAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementHeadWorkspaceNotificationRecipientUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckEntityExistsWorkspaceNotificationRecipientUser_ApiManagementHeadWorkspaceNotificationRecipientUser() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceNotificationRecipientUser.json + // this example is just showing the usage of "WorkspaceNotificationRecipientUser_CheckEntityExists" 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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation + string userId = "576823d0a40f7e74ec07d642"; + bool result = await serviceWorkspaceNotification.CheckEntityExistsWorkspaceNotificationRecipientUserAsync(userId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementCreateWorkspaceNotificationRecipientUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdateWorkspaceNotificationRecipientUser_ApiManagementCreateWorkspaceNotificationRecipientUser() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceNotificationRecipientUser.json + // this example is just showing the usage of "WorkspaceNotificationRecipientUser_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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation + string userId = "576823d0a40f7e74ec07d642"; + RecipientUserContract result = await serviceWorkspaceNotification.CreateOrUpdateWorkspaceNotificationRecipientUserAsync(userId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementDeleteWorkspaceNotificationRecipientUser + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task DeleteWorkspaceNotificationRecipientUser_ApiManagementDeleteWorkspaceNotificationRecipientUser() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceNotificationRecipientUser.json + // this example is just showing the usage of "WorkspaceNotificationRecipientUser_Delete" 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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation + string userId = "576823d0a40f7e74ec07d642"; + await serviceWorkspaceNotification.DeleteWorkspaceNotificationRecipientUserAsync(userId); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementListWorkspaceNotificationRecipientEmails + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWorkspaceNotificationRecipientEmailsByNotification_ApiManagementListWorkspaceNotificationRecipientEmails() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceNotificationRecipientEmails.json + // this example is just showing the usage of "WorkspaceNotificationRecipientEmail_ListByNotification" 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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation and iterate over the result + await foreach (RecipientEmailContract item in serviceWorkspaceNotification.GetWorkspaceNotificationRecipientEmailsByNotificationAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementHeadWorkspaceNotificationRecipientEmail + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckEntityExistsWorkspaceNotificationRecipientEmail_ApiManagementHeadWorkspaceNotificationRecipientEmail() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceNotificationRecipientEmail.json + // this example is just showing the usage of "WorkspaceNotificationRecipientEmail_CheckEntityExists" 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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation + string email = "contoso@live.com"; + bool result = await serviceWorkspaceNotification.CheckEntityExistsWorkspaceNotificationRecipientEmailAsync(email); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementCreateWorkspaceNotificationRecipientEmail + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdateWorkspaceNotificationRecipientEmail_ApiManagementCreateWorkspaceNotificationRecipientEmail() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceNotificationRecipientEmail.json + // this example is just showing the usage of "WorkspaceNotificationRecipientEmail_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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation + string email = "foobar@live.com"; + RecipientEmailContract result = await serviceWorkspaceNotification.CreateOrUpdateWorkspaceNotificationRecipientEmailAsync(email); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementDeleteWorkspaceNotificationRecipientEmail + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task DeleteWorkspaceNotificationRecipientEmail_ApiManagementDeleteWorkspaceNotificationRecipientEmail() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceNotificationRecipientEmail.json + // this example is just showing the usage of "WorkspaceNotificationRecipientEmail_Delete" 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 ServiceWorkspaceNotificationResource created on azure + // for more information of creating ServiceWorkspaceNotificationResource, please refer to the document of ServiceWorkspaceNotificationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + NotificationName notificationName = NotificationName.RequestPublisherNotificationMessage; + ResourceIdentifier serviceWorkspaceNotificationResourceId = ServiceWorkspaceNotificationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + ServiceWorkspaceNotificationResource serviceWorkspaceNotification = client.GetServiceWorkspaceNotificationResource(serviceWorkspaceNotificationResourceId); + + // invoke the operation + string email = "contoso@live.com"; + await serviceWorkspaceNotification.DeleteWorkspaceNotificationRecipientEmailAsync(email); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyCollection.cs new file mode 100644 index 000000000000..11eef8150926 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyCollection.cs @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspacePolicyCollection + { + // ApiManagementListWorkspacePolicies + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspacePolicies() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspacePolicies.json + // this example is just showing the usage of "WorkspacePolicy_ListByApi" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyResource + ServiceWorkspacePolicyCollection collection = workspaceContract.GetServiceWorkspacePolicies(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspacePolicyResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspacePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspacePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicy.json + // this example is just showing the usage of "WorkspacePolicy_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyResource + ServiceWorkspacePolicyCollection collection = workspaceContract.GetServiceWorkspacePolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + ServiceWorkspacePolicyResource result = await collection.GetAsync(policyId); + + // 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}"); + } + + // ApiManagementGetWorkspacePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspacePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicy.json + // this example is just showing the usage of "WorkspacePolicy_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyResource + ServiceWorkspacePolicyCollection collection = workspaceContract.GetServiceWorkspacePolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + bool result = await collection.ExistsAsync(policyId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspacePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspacePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicy.json + // this example is just showing the usage of "WorkspacePolicy_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyResource + ServiceWorkspacePolicyCollection collection = workspaceContract.GetServiceWorkspacePolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + NullableResponse response = await collection.GetIfExistsAsync(policyId); + ServiceWorkspacePolicyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateWorkspacePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspacePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspacePolicy.json + // this example is just showing the usage of "WorkspacePolicy_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyResource + ServiceWorkspacePolicyCollection collection = workspaceContract.GetServiceWorkspacePolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + PolicyContractData data = new PolicyContractData() + { + Value = " ", + Format = PolicyContentFormat.Xml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyId, data, ifMatch: ifMatch); + ServiceWorkspacePolicyResource 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}"); + } + + // ApiManagementCreateWorkspacePolicyNonXmlEncoded + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspacePolicyNonXmlEncoded() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspacePolicyNonXmlEncoded.json + // this example is just showing the usage of "WorkspacePolicy_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyResource + ServiceWorkspacePolicyCollection collection = workspaceContract.GetServiceWorkspacePolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + PolicyContractData data = new PolicyContractData() + { + Value = "\r\n \r\n \r\n \r\n \"@(context.Request.Headers.FirstOrDefault(h => h.Ke==\"Via\"))\" \r\n \r\n \r\n ", + Format = PolicyContentFormat.RawXml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyId, data, ifMatch: ifMatch); + ServiceWorkspacePolicyResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyFragmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyFragmentCollection.cs new file mode 100644 index 000000000000..2623ed32ee94 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyFragmentCollection.cs @@ -0,0 +1,329 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspacePolicyFragmentCollection + { + // ApiManagementListWorkspacePolicyFragments + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspacePolicyFragments() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspacePolicyFragments.json + // this example is just showing the usage of "WorkspacePolicyFragment_ListByService" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyFragmentResource + ServiceWorkspacePolicyFragmentCollection collection = workspaceContract.GetServiceWorkspacePolicyFragments(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspacePolicyFragmentResource item in collection.GetAllAsync()) + { + // the variable item 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 + PolicyFragmentContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspacePolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspacePolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicyFragment.json + // this example is just showing the usage of "WorkspacePolicyFragment_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyFragmentResource + ServiceWorkspacePolicyFragmentCollection collection = workspaceContract.GetServiceWorkspacePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + ServiceWorkspacePolicyFragmentResource result = await collection.GetAsync(id); + + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspacePolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspacePolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicyFragment.json + // this example is just showing the usage of "WorkspacePolicyFragment_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyFragmentResource + ServiceWorkspacePolicyFragmentCollection collection = workspaceContract.GetServiceWorkspacePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + bool result = await collection.ExistsAsync(id); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspacePolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspacePolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicyFragment.json + // this example is just showing the usage of "WorkspacePolicyFragment_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyFragmentResource + ServiceWorkspacePolicyFragmentCollection collection = workspaceContract.GetServiceWorkspacePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + NullableResponse response = await collection.GetIfExistsAsync(id); + ServiceWorkspacePolicyFragmentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementGetWorkspacePolicyFragmentFormat + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspacePolicyFragmentFormat() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicyFragmentFormat.json + // this example is just showing the usage of "WorkspacePolicyFragment_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyFragmentResource + ServiceWorkspacePolicyFragmentCollection collection = workspaceContract.GetServiceWorkspacePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + PolicyFragmentContentFormat? format = PolicyFragmentContentFormat.Rawxml; + ServiceWorkspacePolicyFragmentResource result = await collection.GetAsync(id, format: format); + + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspacePolicyFragmentFormat + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspacePolicyFragmentFormat() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicyFragmentFormat.json + // this example is just showing the usage of "WorkspacePolicyFragment_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyFragmentResource + ServiceWorkspacePolicyFragmentCollection collection = workspaceContract.GetServiceWorkspacePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + PolicyFragmentContentFormat? format = PolicyFragmentContentFormat.Rawxml; + bool result = await collection.ExistsAsync(id, format: format); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspacePolicyFragmentFormat + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspacePolicyFragmentFormat() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicyFragmentFormat.json + // this example is just showing the usage of "WorkspacePolicyFragment_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyFragmentResource + ServiceWorkspacePolicyFragmentCollection collection = workspaceContract.GetServiceWorkspacePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + PolicyFragmentContentFormat? format = PolicyFragmentContentFormat.Rawxml; + NullableResponse response = await collection.GetIfExistsAsync(id, format: format); + ServiceWorkspacePolicyFragmentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspacePolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspacePolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspacePolicyFragment.json + // this example is just showing the usage of "WorkspacePolicyFragment_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspacePolicyFragmentResource + ServiceWorkspacePolicyFragmentCollection collection = workspaceContract.GetServiceWorkspacePolicyFragments(); + + // invoke the operation + string id = "policyFragment1"; + PolicyFragmentContractData data = new PolicyFragmentContractData() + { + Value = "", + Description = "A policy fragment example", + Format = PolicyFragmentContentFormat.Xml, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, id, data); + ServiceWorkspacePolicyFragmentResource 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyFragmentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyFragmentResource.cs new file mode 100644 index 000000000000..59533226e856 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyFragmentResource.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspacePolicyFragmentResource + { + // ApiManagementHeadWorkspacePolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspacePolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspacePolicyFragment.json + // this example is just showing the usage of "WorkspacePolicyFragment_GetEntityTag" 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 ServiceWorkspacePolicyFragmentResource created on azure + // for more information of creating ServiceWorkspacePolicyFragmentResource, please refer to the document of ServiceWorkspacePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string id = "policyFragment1"; + ResourceIdentifier serviceWorkspacePolicyFragmentResourceId = ServiceWorkspacePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + ServiceWorkspacePolicyFragmentResource serviceWorkspacePolicyFragment = client.GetServiceWorkspacePolicyFragmentResource(serviceWorkspacePolicyFragmentResourceId); + + // invoke the operation + bool result = await serviceWorkspacePolicyFragment.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspacePolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspacePolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicyFragment.json + // this example is just showing the usage of "WorkspacePolicyFragment_Get" 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 ServiceWorkspacePolicyFragmentResource created on azure + // for more information of creating ServiceWorkspacePolicyFragmentResource, please refer to the document of ServiceWorkspacePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string id = "policyFragment1"; + ResourceIdentifier serviceWorkspacePolicyFragmentResourceId = ServiceWorkspacePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + ServiceWorkspacePolicyFragmentResource serviceWorkspacePolicyFragment = client.GetServiceWorkspacePolicyFragmentResource(serviceWorkspacePolicyFragmentResourceId); + + // invoke the operation + ServiceWorkspacePolicyFragmentResource result = await serviceWorkspacePolicyFragment.GetAsync(); + + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspacePolicyFragmentFormat + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspacePolicyFragmentFormat() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicyFragmentFormat.json + // this example is just showing the usage of "WorkspacePolicyFragment_Get" 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 ServiceWorkspacePolicyFragmentResource created on azure + // for more information of creating ServiceWorkspacePolicyFragmentResource, please refer to the document of ServiceWorkspacePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string id = "policyFragment1"; + ResourceIdentifier serviceWorkspacePolicyFragmentResourceId = ServiceWorkspacePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + ServiceWorkspacePolicyFragmentResource serviceWorkspacePolicyFragment = client.GetServiceWorkspacePolicyFragmentResource(serviceWorkspacePolicyFragmentResourceId); + + // invoke the operation + PolicyFragmentContentFormat? format = PolicyFragmentContentFormat.Rawxml; + ServiceWorkspacePolicyFragmentResource result = await serviceWorkspacePolicyFragment.GetAsync(format: format); + + // 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspacePolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspacePolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspacePolicyFragment.json + // this example is just showing the usage of "WorkspacePolicyFragment_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 ServiceWorkspacePolicyFragmentResource created on azure + // for more information of creating ServiceWorkspacePolicyFragmentResource, please refer to the document of ServiceWorkspacePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string id = "policyFragment1"; + ResourceIdentifier serviceWorkspacePolicyFragmentResourceId = ServiceWorkspacePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + ServiceWorkspacePolicyFragmentResource serviceWorkspacePolicyFragment = client.GetServiceWorkspacePolicyFragmentResource(serviceWorkspacePolicyFragmentResourceId); + + // invoke the operation + PolicyFragmentContractData data = new PolicyFragmentContractData() + { + Value = "", + Description = "A policy fragment example", + Format = PolicyFragmentContentFormat.Xml, + }; + ArmOperation lro = await serviceWorkspacePolicyFragment.UpdateAsync(WaitUntil.Completed, data); + ServiceWorkspacePolicyFragmentResource 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 + PolicyFragmentContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspacePolicyFragment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspacePolicyFragment() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspacePolicyFragment.json + // this example is just showing the usage of "WorkspacePolicyFragment_Delete" 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 ServiceWorkspacePolicyFragmentResource created on azure + // for more information of creating ServiceWorkspacePolicyFragmentResource, please refer to the document of ServiceWorkspacePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string id = "policyFragment1"; + ResourceIdentifier serviceWorkspacePolicyFragmentResourceId = ServiceWorkspacePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + ServiceWorkspacePolicyFragmentResource serviceWorkspacePolicyFragment = client.GetServiceWorkspacePolicyFragmentResource(serviceWorkspacePolicyFragmentResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspacePolicyFragment.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementListWorkspacePolicyFragmentReferences + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetReferences_ApiManagementListWorkspacePolicyFragmentReferences() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspacePolicyFragmentReferences.json + // this example is just showing the usage of "WorkspacePolicyFragment_ListReferences" 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 ServiceWorkspacePolicyFragmentResource created on azure + // for more information of creating ServiceWorkspacePolicyFragmentResource, please refer to the document of ServiceWorkspacePolicyFragmentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string id = "policyFragment1"; + ResourceIdentifier serviceWorkspacePolicyFragmentResourceId = ServiceWorkspacePolicyFragmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + ServiceWorkspacePolicyFragmentResource serviceWorkspacePolicyFragment = client.GetServiceWorkspacePolicyFragmentResource(serviceWorkspacePolicyFragmentResourceId); + + // invoke the operation and iterate over the result + await foreach (ResourceCollectionValueItem item in serviceWorkspacePolicyFragment.GetReferencesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyResource.cs new file mode 100644 index 000000000000..55e72a3ebe59 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspacePolicyResource.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspacePolicyResource + { + // ApiManagementHeadWorkspacePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspacePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspacePolicy.json + // this example is just showing the usage of "WorkspacePolicy_GetEntityTag" 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 ServiceWorkspacePolicyResource created on azure + // for more information of creating ServiceWorkspacePolicyResource, please refer to the document of ServiceWorkspacePolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspacePolicyResourceId = ServiceWorkspacePolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId); + ServiceWorkspacePolicyResource serviceWorkspacePolicy = client.GetServiceWorkspacePolicyResource(serviceWorkspacePolicyResourceId); + + // invoke the operation + bool result = await serviceWorkspacePolicy.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspacePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspacePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspacePolicy.json + // this example is just showing the usage of "WorkspacePolicy_Get" 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 ServiceWorkspacePolicyResource created on azure + // for more information of creating ServiceWorkspacePolicyResource, please refer to the document of ServiceWorkspacePolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspacePolicyResourceId = ServiceWorkspacePolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId); + ServiceWorkspacePolicyResource serviceWorkspacePolicy = client.GetServiceWorkspacePolicyResource(serviceWorkspacePolicyResourceId); + + // invoke the operation + ServiceWorkspacePolicyResource result = await serviceWorkspacePolicy.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateWorkspacePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspacePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspacePolicy.json + // this example is just showing the usage of "WorkspacePolicy_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 ServiceWorkspacePolicyResource created on azure + // for more information of creating ServiceWorkspacePolicyResource, please refer to the document of ServiceWorkspacePolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspacePolicyResourceId = ServiceWorkspacePolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId); + ServiceWorkspacePolicyResource serviceWorkspacePolicy = client.GetServiceWorkspacePolicyResource(serviceWorkspacePolicyResourceId); + + // invoke the operation + PolicyContractData data = new PolicyContractData() + { + Value = " ", + Format = PolicyContentFormat.Xml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await serviceWorkspacePolicy.UpdateAsync(WaitUntil.Completed, data, ifMatch: ifMatch); + ServiceWorkspacePolicyResource 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}"); + } + + // ApiManagementCreateWorkspacePolicyNonXmlEncoded + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspacePolicyNonXmlEncoded() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspacePolicyNonXmlEncoded.json + // this example is just showing the usage of "WorkspacePolicy_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 ServiceWorkspacePolicyResource created on azure + // for more information of creating ServiceWorkspacePolicyResource, please refer to the document of ServiceWorkspacePolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspacePolicyResourceId = ServiceWorkspacePolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId); + ServiceWorkspacePolicyResource serviceWorkspacePolicy = client.GetServiceWorkspacePolicyResource(serviceWorkspacePolicyResourceId); + + // invoke the operation + PolicyContractData data = new PolicyContractData() + { + Value = "\r\n \r\n \r\n \r\n \"@(context.Request.Headers.FirstOrDefault(h => h.Ke==\"Via\"))\" \r\n \r\n \r\n ", + Format = PolicyContentFormat.RawXml, + }; + ETag? ifMatch = new ETag("*"); + ArmOperation lro = await serviceWorkspacePolicy.UpdateAsync(WaitUntil.Completed, data, ifMatch: ifMatch); + ServiceWorkspacePolicyResource 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}"); + } + + // ApiManagementDeleteWorkspacePolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspacePolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspacePolicy.json + // this example is just showing the usage of "WorkspacePolicy_Delete" 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 ServiceWorkspacePolicyResource created on azure + // for more information of creating ServiceWorkspacePolicyResource, please refer to the document of ServiceWorkspacePolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspacePolicyResourceId = ServiceWorkspacePolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId); + ServiceWorkspacePolicyResource serviceWorkspacePolicy = client.GetServiceWorkspacePolicyResource(serviceWorkspacePolicyResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspacePolicy.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductApiLinkCollection.cs new file mode 100644 index 000000000000..f10054a3e4df --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductApiLinkCollection.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceProductApiLinkCollection + { + // ApiManagementListWorkspaceProductApiLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceProductApiLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceProductApiLinks.json + // this example is just showing the usage of "WorkspaceProductApiLink_ListByProduct" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "product1"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductApiLinkResource + ServiceWorkspaceProductApiLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductApiLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceProductApiLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + ProductApiLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductApiLink.json + // this example is just showing the usage of "WorkspaceProductApiLink_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductApiLinkResource + ServiceWorkspaceProductApiLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + ServiceWorkspaceProductApiLinkResource result = await collection.GetAsync(apiLinkId); + + // 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductApiLink.json + // this example is just showing the usage of "WorkspaceProductApiLink_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductApiLinkResource + ServiceWorkspaceProductApiLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + bool result = await collection.ExistsAsync(apiLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductApiLink.json + // this example is just showing the usage of "WorkspaceProductApiLink_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductApiLinkResource + ServiceWorkspaceProductApiLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(apiLinkId); + ServiceWorkspaceProductApiLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceProductApiLink.json + // this example is just showing the usage of "WorkspaceProductApiLink_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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductApiLinkResource + ServiceWorkspaceProductApiLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + ProductApiLinkContractData data = new ProductApiLinkContractData() + { + ApiId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiLinkId, data); + ServiceWorkspaceProductApiLinkResource 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductApiLinkResource.cs new file mode 100644 index 000000000000..438a266864ab --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductApiLinkResource.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceProductApiLinkResource + { + // ApiManagementGetWorkspaceProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductApiLink.json + // this example is just showing the usage of "WorkspaceProductApiLink_Get" 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 ServiceWorkspaceProductApiLinkResource created on azure + // for more information of creating ServiceWorkspaceProductApiLinkResource, please refer to the document of ServiceWorkspaceProductApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + string apiLinkId = "link1"; + ResourceIdentifier serviceWorkspaceProductApiLinkResourceId = ServiceWorkspaceProductApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + ServiceWorkspaceProductApiLinkResource serviceWorkspaceProductApiLink = client.GetServiceWorkspaceProductApiLinkResource(serviceWorkspaceProductApiLinkResourceId); + + // invoke the operation + ServiceWorkspaceProductApiLinkResource result = await serviceWorkspaceProductApiLink.GetAsync(); + + // 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceProductApiLink.json + // this example is just showing the usage of "WorkspaceProductApiLink_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 ServiceWorkspaceProductApiLinkResource created on azure + // for more information of creating ServiceWorkspaceProductApiLinkResource, please refer to the document of ServiceWorkspaceProductApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + string apiLinkId = "link1"; + ResourceIdentifier serviceWorkspaceProductApiLinkResourceId = ServiceWorkspaceProductApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + ServiceWorkspaceProductApiLinkResource serviceWorkspaceProductApiLink = client.GetServiceWorkspaceProductApiLinkResource(serviceWorkspaceProductApiLinkResourceId); + + // invoke the operation + ProductApiLinkContractData data = new ProductApiLinkContractData() + { + ApiId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api", + }; + ArmOperation lro = await serviceWorkspaceProductApiLink.UpdateAsync(WaitUntil.Completed, data); + ServiceWorkspaceProductApiLinkResource 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 + ProductApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceProductApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceProductApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceProductApiLink.json + // this example is just showing the usage of "WorkspaceProductApiLink_Delete" 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 ServiceWorkspaceProductApiLinkResource created on azure + // for more information of creating ServiceWorkspaceProductApiLinkResource, please refer to the document of ServiceWorkspaceProductApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + string apiLinkId = "link1"; + ResourceIdentifier serviceWorkspaceProductApiLinkResourceId = ServiceWorkspaceProductApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + ServiceWorkspaceProductApiLinkResource serviceWorkspaceProductApiLink = client.GetServiceWorkspaceProductApiLinkResource(serviceWorkspaceProductApiLinkResourceId); + + // invoke the operation + await serviceWorkspaceProductApiLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductCollection.cs new file mode 100644 index 000000000000..7e4d740089fb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceProductCollection + { + // ApiManagementListWorkspaceProducts + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceProducts() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceProducts.json + // this example is just showing the usage of "WorkspaceProduct_ListByService" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceProductResource + ServiceWorkspaceProductCollection collection = workspaceContract.GetServiceWorkspaceProducts(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceProductResource item in collection.GetAllAsync()) + { + // the variable item 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 + ApiManagementProductData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceProduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceProduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProduct.json + // this example is just showing the usage of "WorkspaceProduct_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceProductResource + ServiceWorkspaceProductCollection collection = workspaceContract.GetServiceWorkspaceProducts(); + + // invoke the operation + string productId = "unlimited"; + ServiceWorkspaceProductResource result = await collection.GetAsync(productId); + + // 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 + ApiManagementProductData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceProduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceProduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProduct.json + // this example is just showing the usage of "WorkspaceProduct_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceProductResource + ServiceWorkspaceProductCollection collection = workspaceContract.GetServiceWorkspaceProducts(); + + // invoke the operation + string productId = "unlimited"; + bool result = await collection.ExistsAsync(productId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceProduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceProduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProduct.json + // this example is just showing the usage of "WorkspaceProduct_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceProductResource + ServiceWorkspaceProductCollection collection = workspaceContract.GetServiceWorkspaceProducts(); + + // invoke the operation + string productId = "unlimited"; + NullableResponse response = await collection.GetIfExistsAsync(productId); + ServiceWorkspaceProductResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ApiManagementProductData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceProduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceProduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceProduct.json + // this example is just showing the usage of "WorkspaceProduct_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceProductResource + ServiceWorkspaceProductCollection collection = workspaceContract.GetServiceWorkspaceProducts(); + + // invoke the operation + string productId = "testproduct"; + ApiManagementProductData data = new ApiManagementProductData() + { + DisplayName = "Test Template ProductName 4", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, productId, data); + ServiceWorkspaceProductResource 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 + ApiManagementProductData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductGroupLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductGroupLinkCollection.cs new file mode 100644 index 000000000000..674925f37141 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductGroupLinkCollection.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceProductGroupLinkCollection + { + // ApiManagementListWorkspaceProductGroupLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceProductGroupLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceProductGroupLinks.json + // this example is just showing the usage of "WorkspaceProductGroupLink_ListByProduct" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "product1"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductGroupLinkResource + ServiceWorkspaceProductGroupLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductGroupLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceProductGroupLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + ProductGroupLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductGroupLink.json + // this example is just showing the usage of "WorkspaceProductGroupLink_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductGroupLinkResource + ServiceWorkspaceProductGroupLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductGroupLinks(); + + // invoke the operation + string groupLinkId = "link1"; + ServiceWorkspaceProductGroupLinkResource result = await collection.GetAsync(groupLinkId); + + // 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductGroupLink.json + // this example is just showing the usage of "WorkspaceProductGroupLink_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductGroupLinkResource + ServiceWorkspaceProductGroupLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductGroupLinks(); + + // invoke the operation + string groupLinkId = "link1"; + bool result = await collection.ExistsAsync(groupLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductGroupLink.json + // this example is just showing the usage of "WorkspaceProductGroupLink_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductGroupLinkResource + ServiceWorkspaceProductGroupLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductGroupLinks(); + + // invoke the operation + string groupLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(groupLinkId); + ServiceWorkspaceProductGroupLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceProductGroupLink.json + // this example is just showing the usage of "WorkspaceProductGroupLink_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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductGroupLinkResource + ServiceWorkspaceProductGroupLinkCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductGroupLinks(); + + // invoke the operation + string groupLinkId = "link1"; + ProductGroupLinkContractData data = new ProductGroupLinkContractData() + { + GroupId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/groups/group1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, groupLinkId, data); + ServiceWorkspaceProductGroupLinkResource 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductGroupLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductGroupLinkResource.cs new file mode 100644 index 000000000000..cca19882f61b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductGroupLinkResource.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceProductGroupLinkResource + { + // ApiManagementGetWorkspaceProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductGroupLink.json + // this example is just showing the usage of "WorkspaceProductGroupLink_Get" 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 ServiceWorkspaceProductGroupLinkResource created on azure + // for more information of creating ServiceWorkspaceProductGroupLinkResource, please refer to the document of ServiceWorkspaceProductGroupLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + string groupLinkId = "link1"; + ResourceIdentifier serviceWorkspaceProductGroupLinkResourceId = ServiceWorkspaceProductGroupLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + ServiceWorkspaceProductGroupLinkResource serviceWorkspaceProductGroupLink = client.GetServiceWorkspaceProductGroupLinkResource(serviceWorkspaceProductGroupLinkResourceId); + + // invoke the operation + ServiceWorkspaceProductGroupLinkResource result = await serviceWorkspaceProductGroupLink.GetAsync(); + + // 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceProductGroupLink.json + // this example is just showing the usage of "WorkspaceProductGroupLink_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 ServiceWorkspaceProductGroupLinkResource created on azure + // for more information of creating ServiceWorkspaceProductGroupLinkResource, please refer to the document of ServiceWorkspaceProductGroupLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + string groupLinkId = "link1"; + ResourceIdentifier serviceWorkspaceProductGroupLinkResourceId = ServiceWorkspaceProductGroupLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + ServiceWorkspaceProductGroupLinkResource serviceWorkspaceProductGroupLink = client.GetServiceWorkspaceProductGroupLinkResource(serviceWorkspaceProductGroupLinkResourceId); + + // invoke the operation + ProductGroupLinkContractData data = new ProductGroupLinkContractData() + { + GroupId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/groups/group1", + }; + ArmOperation lro = await serviceWorkspaceProductGroupLink.UpdateAsync(WaitUntil.Completed, data); + ServiceWorkspaceProductGroupLinkResource 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 + ProductGroupLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceProductGroupLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceProductGroupLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceProductGroupLink.json + // this example is just showing the usage of "WorkspaceProductGroupLink_Delete" 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 ServiceWorkspaceProductGroupLinkResource created on azure + // for more information of creating ServiceWorkspaceProductGroupLinkResource, please refer to the document of ServiceWorkspaceProductGroupLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + string groupLinkId = "link1"; + ResourceIdentifier serviceWorkspaceProductGroupLinkResourceId = ServiceWorkspaceProductGroupLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + ServiceWorkspaceProductGroupLinkResource serviceWorkspaceProductGroupLink = client.GetServiceWorkspaceProductGroupLinkResource(serviceWorkspaceProductGroupLinkResourceId); + + // invoke the operation + await serviceWorkspaceProductGroupLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductPolicyCollection.cs new file mode 100644 index 000000000000..73c6ef81aa86 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductPolicyCollection.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceProductPolicyCollection + { + // ApiManagementListWorkspaceProductPolicies + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceProductPolicies() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceProductPolicies.json + // this example is just showing the usage of "WorkspaceProductPolicy_ListByProduct" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "armTemplateProduct4"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductPolicyResource + ServiceWorkspaceProductPolicyCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductPolicies(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceProductPolicyResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceProductPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceProductPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductPolicy.json + // this example is just showing the usage of "WorkspaceProductPolicy_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "kjoshiarmTemplateProduct4"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductPolicyResource + ServiceWorkspaceProductPolicyCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + ServiceWorkspaceProductPolicyResource result = await collection.GetAsync(policyId); + + // 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}"); + } + + // ApiManagementGetWorkspaceProductPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceProductPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductPolicy.json + // this example is just showing the usage of "WorkspaceProductPolicy_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "kjoshiarmTemplateProduct4"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductPolicyResource + ServiceWorkspaceProductPolicyCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + bool result = await collection.ExistsAsync(policyId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceProductPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceProductPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductPolicy.json + // this example is just showing the usage of "WorkspaceProductPolicy_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "kjoshiarmTemplateProduct4"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductPolicyResource + ServiceWorkspaceProductPolicyCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + NullableResponse response = await collection.GetIfExistsAsync(policyId); + ServiceWorkspaceProductPolicyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateWorkspaceProductPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceProductPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceProductPolicy.json + // this example is just showing the usage of "WorkspaceProductPolicy_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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "5702e97e5157a50f48dce801"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // get the collection of this ServiceWorkspaceProductPolicyResource + ServiceWorkspaceProductPolicyCollection collection = serviceWorkspaceProduct.GetServiceWorkspaceProductPolicies(); + + // invoke the operation + PolicyName policyId = PolicyName.Policy; + PolicyContractData data = new PolicyContractData() + { + Value = "\r\n \r\n \r\n \r\n @( string.Join(\",\", DateTime.UtcNow, context.Deployment.ServiceName, context.RequestId, context.Request.IpAddress, context.Operation.Name) ) \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", + Format = PolicyContentFormat.Xml, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyId, data); + ServiceWorkspaceProductPolicyResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductPolicyResource.cs new file mode 100644 index 000000000000..c108fdb6c0e0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductPolicyResource.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceProductPolicyResource + { + // ApiManagementHeadWorkspaceProductPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceProductPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceProductPolicy.json + // this example is just showing the usage of "WorkspaceProductPolicy_GetEntityTag" 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 ServiceWorkspaceProductPolicyResource created on azure + // for more information of creating ServiceWorkspaceProductPolicyResource, please refer to the document of ServiceWorkspaceProductPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "unlimited"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceProductPolicyResourceId = ServiceWorkspaceProductPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId); + ServiceWorkspaceProductPolicyResource serviceWorkspaceProductPolicy = client.GetServiceWorkspaceProductPolicyResource(serviceWorkspaceProductPolicyResourceId); + + // invoke the operation + bool result = await serviceWorkspaceProductPolicy.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceProductPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceProductPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProductPolicy.json + // this example is just showing the usage of "WorkspaceProductPolicy_Get" 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 ServiceWorkspaceProductPolicyResource created on azure + // for more information of creating ServiceWorkspaceProductPolicyResource, please refer to the document of ServiceWorkspaceProductPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "kjoshiarmTemplateProduct4"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceProductPolicyResourceId = ServiceWorkspaceProductPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId); + ServiceWorkspaceProductPolicyResource serviceWorkspaceProductPolicy = client.GetServiceWorkspaceProductPolicyResource(serviceWorkspaceProductPolicyResourceId); + + // invoke the operation + ServiceWorkspaceProductPolicyResource result = await serviceWorkspaceProductPolicy.GetAsync(); + + // 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}"); + } + + // ApiManagementCreateWorkspaceProductPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceProductPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceProductPolicy.json + // this example is just showing the usage of "WorkspaceProductPolicy_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 ServiceWorkspaceProductPolicyResource created on azure + // for more information of creating ServiceWorkspaceProductPolicyResource, please refer to the document of ServiceWorkspaceProductPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "5702e97e5157a50f48dce801"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceProductPolicyResourceId = ServiceWorkspaceProductPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId); + ServiceWorkspaceProductPolicyResource serviceWorkspaceProductPolicy = client.GetServiceWorkspaceProductPolicyResource(serviceWorkspaceProductPolicyResourceId); + + // invoke the operation + PolicyContractData data = new PolicyContractData() + { + Value = "\r\n \r\n \r\n \r\n @( string.Join(\",\", DateTime.UtcNow, context.Deployment.ServiceName, context.RequestId, context.Request.IpAddress, context.Operation.Name) ) \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n", + Format = PolicyContentFormat.Xml, + }; + ArmOperation lro = await serviceWorkspaceProductPolicy.UpdateAsync(WaitUntil.Completed, data); + ServiceWorkspaceProductPolicyResource 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}"); + } + + // ApiManagementDeleteWorkspaceProductPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceProductPolicy() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceProductPolicy.json + // this example is just showing the usage of "WorkspaceProductPolicy_Delete" 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 ServiceWorkspaceProductPolicyResource created on azure + // for more information of creating ServiceWorkspaceProductPolicyResource, please refer to the document of ServiceWorkspaceProductPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + PolicyName policyId = PolicyName.Policy; + ResourceIdentifier serviceWorkspaceProductPolicyResourceId = ServiceWorkspaceProductPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId); + ServiceWorkspaceProductPolicyResource serviceWorkspaceProductPolicy = client.GetServiceWorkspaceProductPolicyResource(serviceWorkspaceProductPolicyResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceProductPolicy.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductResource.cs new file mode 100644 index 000000000000..e2e00c885e3a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceProductResource.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceProductResource + { + // ApiManagementHeadWorkspaceProduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceProduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceProduct.json + // this example is just showing the usage of "WorkspaceProduct_GetEntityTag" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "unlimited"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // invoke the operation + bool result = await serviceWorkspaceProduct.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceProduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceProduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceProduct.json + // this example is just showing the usage of "WorkspaceProduct_Get" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "unlimited"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // invoke the operation + ServiceWorkspaceProductResource result = await serviceWorkspaceProduct.GetAsync(); + + // 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 + ApiManagementProductData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementUpdateWorkspaceProduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspaceProduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspaceProduct.json + // this example is just showing the usage of "WorkspaceProduct_Update" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + ProductUpdateParameters productUpdateParameters = new ProductUpdateParameters() + { + DisplayName = "Test Template ProductName 4", + }; + ServiceWorkspaceProductResource result = await serviceWorkspaceProduct.UpdateAsync(ifMatch, productUpdateParameters); + + // 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 + ApiManagementProductData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceProduct + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceProduct() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceProduct.json + // this example is just showing the usage of "WorkspaceProduct_Delete" 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 ServiceWorkspaceProductResource created on azure + // for more information of creating ServiceWorkspaceProductResource, please refer to the document of ServiceWorkspaceProductResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string productId = "testproduct"; + ResourceIdentifier serviceWorkspaceProductResourceId = ServiceWorkspaceProductResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + ServiceWorkspaceProductResource serviceWorkspaceProduct = client.GetServiceWorkspaceProductResource(serviceWorkspaceProductResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + bool? deleteSubscriptions = true; + await serviceWorkspaceProduct.DeleteAsync(WaitUntil.Completed, ifMatch, deleteSubscriptions: deleteSubscriptions); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSchemaCollection.cs new file mode 100644 index 000000000000..b4e8e83ab279 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSchemaCollection.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceSchemaCollection + { + // ApiManagementListWorkspaceSchemas + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceSchemas() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceSchemas.json + // this example is just showing the usage of "WorkspaceGlobalSchema_ListByService" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSchemaResource + ServiceWorkspaceSchemaCollection collection = workspaceContract.GetServiceWorkspaceSchemas(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceSchemaResource item in collection.GetAllAsync()) + { + // the variable item 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 + ApiManagementGlobalSchemaData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceSchema.json + // this example is just showing the usage of "WorkspaceGlobalSchema_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSchemaResource + ServiceWorkspaceSchemaCollection collection = workspaceContract.GetServiceWorkspaceSchemas(); + + // invoke the operation + string schemaId = "schema1"; + ServiceWorkspaceSchemaResource result = await collection.GetAsync(schemaId); + + // 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 + ApiManagementGlobalSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceSchema.json + // this example is just showing the usage of "WorkspaceGlobalSchema_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSchemaResource + ServiceWorkspaceSchemaCollection collection = workspaceContract.GetServiceWorkspaceSchemas(); + + // invoke the operation + string schemaId = "schema1"; + bool result = await collection.ExistsAsync(schemaId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceSchema.json + // this example is just showing the usage of "WorkspaceGlobalSchema_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSchemaResource + ServiceWorkspaceSchemaCollection collection = workspaceContract.GetServiceWorkspaceSchemas(); + + // invoke the operation + string schemaId = "schema1"; + NullableResponse response = await collection.GetIfExistsAsync(schemaId); + ServiceWorkspaceSchemaResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + ApiManagementGlobalSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceSchema.json + // this example is just showing the usage of "WorkspaceGlobalSchema_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSchemaResource + ServiceWorkspaceSchemaCollection collection = workspaceContract.GetServiceWorkspaceSchemas(); + + // invoke the operation + string schemaId = "schema1"; + ApiManagementGlobalSchemaData data = new ApiManagementGlobalSchemaData() + { + SchemaType = ApiSchemaType.Xml, + Description = "sample schema description", + Value = BinaryData.FromString("\"\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\""), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schemaId, data); + ServiceWorkspaceSchemaResource 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 + ApiManagementGlobalSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSchemaResource.cs new file mode 100644 index 000000000000..7b570c524229 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSchemaResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceSchemaResource + { + // ApiManagementHeadWorkspaceSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceSchema.json + // this example is just showing the usage of "WorkspaceGlobalSchema_GetEntityTag" 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 ServiceWorkspaceSchemaResource created on azure + // for more information of creating ServiceWorkspaceSchemaResource, please refer to the document of ServiceWorkspaceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string schemaId = "myschema"; + ResourceIdentifier serviceWorkspaceSchemaResourceId = ServiceWorkspaceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + ServiceWorkspaceSchemaResource serviceWorkspaceSchema = client.GetServiceWorkspaceSchemaResource(serviceWorkspaceSchemaResourceId); + + // invoke the operation + bool result = await serviceWorkspaceSchema.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceSchema.json + // this example is just showing the usage of "WorkspaceGlobalSchema_Get" 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 ServiceWorkspaceSchemaResource created on azure + // for more information of creating ServiceWorkspaceSchemaResource, please refer to the document of ServiceWorkspaceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string schemaId = "schema1"; + ResourceIdentifier serviceWorkspaceSchemaResourceId = ServiceWorkspaceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + ServiceWorkspaceSchemaResource serviceWorkspaceSchema = client.GetServiceWorkspaceSchemaResource(serviceWorkspaceSchemaResourceId); + + // invoke the operation + ServiceWorkspaceSchemaResource result = await serviceWorkspaceSchema.GetAsync(); + + // 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 + ApiManagementGlobalSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceSchema.json + // this example is just showing the usage of "WorkspaceGlobalSchema_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 ServiceWorkspaceSchemaResource created on azure + // for more information of creating ServiceWorkspaceSchemaResource, please refer to the document of ServiceWorkspaceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string schemaId = "schema1"; + ResourceIdentifier serviceWorkspaceSchemaResourceId = ServiceWorkspaceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + ServiceWorkspaceSchemaResource serviceWorkspaceSchema = client.GetServiceWorkspaceSchemaResource(serviceWorkspaceSchemaResourceId); + + // invoke the operation + ApiManagementGlobalSchemaData data = new ApiManagementGlobalSchemaData() + { + SchemaType = ApiSchemaType.Xml, + Description = "sample schema description", + Value = BinaryData.FromString("\"\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\""), + }; + ArmOperation lro = await serviceWorkspaceSchema.UpdateAsync(WaitUntil.Completed, data); + ServiceWorkspaceSchemaResource 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 + ApiManagementGlobalSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceSchema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceSchema() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceSchema.json + // this example is just showing the usage of "WorkspaceGlobalSchema_Delete" 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 ServiceWorkspaceSchemaResource created on azure + // for more information of creating ServiceWorkspaceSchemaResource, please refer to the document of ServiceWorkspaceSchemaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string schemaId = "schema1"; + ResourceIdentifier serviceWorkspaceSchemaResourceId = ServiceWorkspaceSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + ServiceWorkspaceSchemaResource serviceWorkspaceSchema = client.GetServiceWorkspaceSchemaResource(serviceWorkspaceSchemaResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceSchema.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSubscriptionCollection.cs new file mode 100644 index 000000000000..adc858741701 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSubscriptionCollection.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceSubscriptionCollection + { + // ApiManagementListWorkspaceSubscriptions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceSubscriptions() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceSubscriptions.json + // this example is just showing the usage of "WorkspaceSubscription_List" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSubscriptionResource + ServiceWorkspaceSubscriptionCollection collection = workspaceContract.GetServiceWorkspaceSubscriptions(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceSubscriptionResource item in collection.GetAllAsync()) + { + // the variable item 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 + SubscriptionContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceSubscription.json + // this example is just showing the usage of "WorkspaceSubscription_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSubscriptionResource + ServiceWorkspaceSubscriptionCollection collection = workspaceContract.GetServiceWorkspaceSubscriptions(); + + // invoke the operation + string sid = "5931a769d8d14f0ad8ce13b8"; + ServiceWorkspaceSubscriptionResource result = await collection.GetAsync(sid); + + // 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 + SubscriptionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceSubscription.json + // this example is just showing the usage of "WorkspaceSubscription_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSubscriptionResource + ServiceWorkspaceSubscriptionCollection collection = workspaceContract.GetServiceWorkspaceSubscriptions(); + + // invoke the operation + string sid = "5931a769d8d14f0ad8ce13b8"; + bool result = await collection.ExistsAsync(sid); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceSubscription.json + // this example is just showing the usage of "WorkspaceSubscription_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSubscriptionResource + ServiceWorkspaceSubscriptionCollection collection = workspaceContract.GetServiceWorkspaceSubscriptions(); + + // invoke the operation + string sid = "5931a769d8d14f0ad8ce13b8"; + NullableResponse response = await collection.GetIfExistsAsync(sid); + ServiceWorkspaceSubscriptionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + SubscriptionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceSubscription.json + // this example is just showing the usage of "WorkspaceSubscription_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceSubscriptionResource + ServiceWorkspaceSubscriptionCollection collection = workspaceContract.GetServiceWorkspaceSubscriptions(); + + // invoke the operation + string sid = "testsub"; + SubscriptionCreateParameters subscriptionCreateParameters = new SubscriptionCreateParameters() + { + OwnerId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7", + Scope = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/products/5600b59475ff190048060002", + DisplayName = "testsub", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sid, subscriptionCreateParameters); + ServiceWorkspaceSubscriptionResource 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 + SubscriptionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSubscriptionResource.cs new file mode 100644 index 000000000000..4ff9733f40cc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceSubscriptionResource.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceSubscriptionResource + { + // ApiManagementHeadWorkspaceSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspaceSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceSubscription.json + // this example is just showing the usage of "WorkspaceSubscription_GetEntityTag" 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 ServiceWorkspaceSubscriptionResource created on azure + // for more information of creating ServiceWorkspaceSubscriptionResource, please refer to the document of ServiceWorkspaceSubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string sid = "5931a769d8d14f0ad8ce13b8"; + ResourceIdentifier serviceWorkspaceSubscriptionResourceId = ServiceWorkspaceSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + ServiceWorkspaceSubscriptionResource serviceWorkspaceSubscription = client.GetServiceWorkspaceSubscriptionResource(serviceWorkspaceSubscriptionResourceId); + + // invoke the operation + bool result = await serviceWorkspaceSubscription.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceSubscription.json + // this example is just showing the usage of "WorkspaceSubscription_Get" 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 ServiceWorkspaceSubscriptionResource created on azure + // for more information of creating ServiceWorkspaceSubscriptionResource, please refer to the document of ServiceWorkspaceSubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string sid = "5931a769d8d14f0ad8ce13b8"; + ResourceIdentifier serviceWorkspaceSubscriptionResourceId = ServiceWorkspaceSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + ServiceWorkspaceSubscriptionResource serviceWorkspaceSubscription = client.GetServiceWorkspaceSubscriptionResource(serviceWorkspaceSubscriptionResourceId); + + // invoke the operation + ServiceWorkspaceSubscriptionResource result = await serviceWorkspaceSubscription.GetAsync(); + + // 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 + SubscriptionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementUpdateWorkspaceSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspaceSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspaceSubscription.json + // this example is just showing the usage of "WorkspaceSubscription_Update" 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 ServiceWorkspaceSubscriptionResource created on azure + // for more information of creating ServiceWorkspaceSubscriptionResource, please refer to the document of ServiceWorkspaceSubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string sid = "testsub"; + ResourceIdentifier serviceWorkspaceSubscriptionResourceId = ServiceWorkspaceSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + ServiceWorkspaceSubscriptionResource serviceWorkspaceSubscription = client.GetServiceWorkspaceSubscriptionResource(serviceWorkspaceSubscriptionResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + SubscriptionUpdateParameters subscriptionUpdateParameters = new SubscriptionUpdateParameters() + { + DisplayName = "testsub", + }; + ServiceWorkspaceSubscriptionResource result = await serviceWorkspaceSubscription.UpdateAsync(ifMatch, subscriptionUpdateParameters); + + // 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 + SubscriptionContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceSubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceSubscription() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceSubscription.json + // this example is just showing the usage of "WorkspaceSubscription_Delete" 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 ServiceWorkspaceSubscriptionResource created on azure + // for more information of creating ServiceWorkspaceSubscriptionResource, please refer to the document of ServiceWorkspaceSubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string sid = "testsub"; + ResourceIdentifier serviceWorkspaceSubscriptionResourceId = ServiceWorkspaceSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + ServiceWorkspaceSubscriptionResource serviceWorkspaceSubscription = client.GetServiceWorkspaceSubscriptionResource(serviceWorkspaceSubscriptionResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceSubscription.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementWorkspaceSubscriptionRegeneratePrimaryKey + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RegeneratePrimaryKey_ApiManagementWorkspaceSubscriptionRegeneratePrimaryKey() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementWorkspaceSubscriptionRegeneratePrimaryKey.json + // this example is just showing the usage of "WorkspaceSubscription_RegeneratePrimaryKey" 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 ServiceWorkspaceSubscriptionResource created on azure + // for more information of creating ServiceWorkspaceSubscriptionResource, please refer to the document of ServiceWorkspaceSubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string sid = "testsub"; + ResourceIdentifier serviceWorkspaceSubscriptionResourceId = ServiceWorkspaceSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + ServiceWorkspaceSubscriptionResource serviceWorkspaceSubscription = client.GetServiceWorkspaceSubscriptionResource(serviceWorkspaceSubscriptionResourceId); + + // invoke the operation + await serviceWorkspaceSubscription.RegeneratePrimaryKeyAsync(); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementWorkspaceSubscriptionRegenerateSecondaryKey + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RegenerateSecondaryKey_ApiManagementWorkspaceSubscriptionRegenerateSecondaryKey() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementWorkspaceSubscriptionRegenerateSecondaryKey.json + // this example is just showing the usage of "WorkspaceSubscription_RegenerateSecondaryKey" 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 ServiceWorkspaceSubscriptionResource created on azure + // for more information of creating ServiceWorkspaceSubscriptionResource, please refer to the document of ServiceWorkspaceSubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string sid = "testsub"; + ResourceIdentifier serviceWorkspaceSubscriptionResourceId = ServiceWorkspaceSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + ServiceWorkspaceSubscriptionResource serviceWorkspaceSubscription = client.GetServiceWorkspaceSubscriptionResource(serviceWorkspaceSubscriptionResourceId); + + // invoke the operation + await serviceWorkspaceSubscription.RegenerateSecondaryKeyAsync(); + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementWorkspaceSubscriptionListSecrets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSecrets_ApiManagementWorkspaceSubscriptionListSecrets() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementWorkspaceSubscriptionListSecrets.json + // this example is just showing the usage of "WorkspaceSubscription_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 ServiceWorkspaceSubscriptionResource created on azure + // for more information of creating ServiceWorkspaceSubscriptionResource, please refer to the document of ServiceWorkspaceSubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string sid = "5931a769d8d14f0ad8ce13b8"; + ResourceIdentifier serviceWorkspaceSubscriptionResourceId = ServiceWorkspaceSubscriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + ServiceWorkspaceSubscriptionResource serviceWorkspaceSubscription = client.GetServiceWorkspaceSubscriptionResource(serviceWorkspaceSubscriptionResourceId); + + // invoke the operation + SubscriptionKeysContract result = await serviceWorkspaceSubscription.GetSecretsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagApiLinkCollection.cs new file mode 100644 index 000000000000..77f65ca812b0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagApiLinkCollection.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceTagApiLinkCollection + { + // ApiManagementListWorkspaceTagApiLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceTagApiLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceTagApiLinks.json + // this example is just showing the usage of "WorkspaceTagApiLink_ListByProduct" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagApiLinkResource + ServiceWorkspaceTagApiLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagApiLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceTagApiLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + TagApiLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagApiLink.json + // this example is just showing the usage of "WorkspaceTagApiLink_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagApiLinkResource + ServiceWorkspaceTagApiLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + ServiceWorkspaceTagApiLinkResource result = await collection.GetAsync(apiLinkId); + + // 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagApiLink.json + // this example is just showing the usage of "WorkspaceTagApiLink_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagApiLinkResource + ServiceWorkspaceTagApiLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + bool result = await collection.ExistsAsync(apiLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagApiLink.json + // this example is just showing the usage of "WorkspaceTagApiLink_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagApiLinkResource + ServiceWorkspaceTagApiLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(apiLinkId); + ServiceWorkspaceTagApiLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceTagApiLink.json + // this example is just showing the usage of "WorkspaceTagApiLink_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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagApiLinkResource + ServiceWorkspaceTagApiLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagApiLinks(); + + // invoke the operation + string apiLinkId = "link1"; + TagApiLinkContractData data = new TagApiLinkContractData() + { + ApiId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiLinkId, data); + ServiceWorkspaceTagApiLinkResource 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagApiLinkResource.cs new file mode 100644 index 000000000000..a42723607f89 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagApiLinkResource.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceTagApiLinkResource + { + // ApiManagementGetWorkspaceTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagApiLink.json + // this example is just showing the usage of "WorkspaceTagApiLink_Get" 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 ServiceWorkspaceTagApiLinkResource created on azure + // for more information of creating ServiceWorkspaceTagApiLinkResource, please refer to the document of ServiceWorkspaceTagApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + string apiLinkId = "link1"; + ResourceIdentifier serviceWorkspaceTagApiLinkResourceId = ServiceWorkspaceTagApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + ServiceWorkspaceTagApiLinkResource serviceWorkspaceTagApiLink = client.GetServiceWorkspaceTagApiLinkResource(serviceWorkspaceTagApiLinkResourceId); + + // invoke the operation + ServiceWorkspaceTagApiLinkResource result = await serviceWorkspaceTagApiLink.GetAsync(); + + // 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceTagApiLink.json + // this example is just showing the usage of "WorkspaceTagApiLink_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 ServiceWorkspaceTagApiLinkResource created on azure + // for more information of creating ServiceWorkspaceTagApiLinkResource, please refer to the document of ServiceWorkspaceTagApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + string apiLinkId = "link1"; + ResourceIdentifier serviceWorkspaceTagApiLinkResourceId = ServiceWorkspaceTagApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + ServiceWorkspaceTagApiLinkResource serviceWorkspaceTagApiLink = client.GetServiceWorkspaceTagApiLinkResource(serviceWorkspaceTagApiLinkResourceId); + + // invoke the operation + TagApiLinkContractData data = new TagApiLinkContractData() + { + ApiId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api", + }; + ArmOperation lro = await serviceWorkspaceTagApiLink.UpdateAsync(WaitUntil.Completed, data); + ServiceWorkspaceTagApiLinkResource 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 + TagApiLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceTagApiLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceTagApiLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceTagApiLink.json + // this example is just showing the usage of "WorkspaceTagApiLink_Delete" 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 ServiceWorkspaceTagApiLinkResource created on azure + // for more information of creating ServiceWorkspaceTagApiLinkResource, please refer to the document of ServiceWorkspaceTagApiLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + string apiLinkId = "link1"; + ResourceIdentifier serviceWorkspaceTagApiLinkResourceId = ServiceWorkspaceTagApiLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + ServiceWorkspaceTagApiLinkResource serviceWorkspaceTagApiLink = client.GetServiceWorkspaceTagApiLinkResource(serviceWorkspaceTagApiLinkResourceId); + + // invoke the operation + await serviceWorkspaceTagApiLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagCollection.cs new file mode 100644 index 000000000000..f5ea5ff3380e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagCollection.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceTagCollection + { + // ApiManagementListWorkspaceTags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceTags() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceTags.json + // this example is just showing the usage of "WorkspaceTag_ListByService" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceTagResource + ServiceWorkspaceTagCollection collection = workspaceContract.GetServiceWorkspaceTags(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceTagResource item in collection.GetAllAsync()) + { + // the variable item 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 = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTag.json + // this example is just showing the usage of "WorkspaceTag_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceTagResource + ServiceWorkspaceTagCollection collection = workspaceContract.GetServiceWorkspaceTags(); + + // invoke the operation + string tagId = "59306a29e4bbd510dc24e5f9"; + ServiceWorkspaceTagResource result = await collection.GetAsync(tagId); + + // 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}"); + } + + // ApiManagementGetWorkspaceTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTag.json + // this example is just showing the usage of "WorkspaceTag_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceTagResource + ServiceWorkspaceTagCollection collection = workspaceContract.GetServiceWorkspaceTags(); + + // invoke the operation + string tagId = "59306a29e4bbd510dc24e5f9"; + bool result = await collection.ExistsAsync(tagId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTag.json + // this example is just showing the usage of "WorkspaceTag_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceTagResource + ServiceWorkspaceTagCollection collection = workspaceContract.GetServiceWorkspaceTags(); + + // invoke the operation + string tagId = "59306a29e4bbd510dc24e5f9"; + NullableResponse response = await collection.GetIfExistsAsync(tagId); + ServiceWorkspaceTagResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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}"); + } + } + + // ApiManagementCreateWorkspaceTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceTag.json + // this example is just showing the usage of "WorkspaceTag_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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // get the collection of this ServiceWorkspaceTagResource + ServiceWorkspaceTagCollection collection = workspaceContract.GetServiceWorkspaceTags(); + + // invoke the operation + string tagId = "tagId1"; + ApiManagementTagCreateOrUpdateContent content = new ApiManagementTagCreateOrUpdateContent() + { + DisplayName = "tag1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, tagId, content); + ServiceWorkspaceTagResource 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}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagOperationLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagOperationLinkCollection.cs new file mode 100644 index 000000000000..dd18ce729e63 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagOperationLinkCollection.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceTagOperationLinkCollection + { + // ApiManagementListWorkspaceTagOperationLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceTagOperationLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceTagOperationLinks.json + // this example is just showing the usage of "WorkspaceTagOperationLink_ListByProduct" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagOperationLinkResource + ServiceWorkspaceTagOperationLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagOperationLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceTagOperationLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + TagOperationLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagOperationLink.json + // this example is just showing the usage of "WorkspaceTagOperationLink_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagOperationLinkResource + ServiceWorkspaceTagOperationLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagOperationLinks(); + + // invoke the operation + string operationLinkId = "link1"; + ServiceWorkspaceTagOperationLinkResource result = await collection.GetAsync(operationLinkId); + + // 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagOperationLink.json + // this example is just showing the usage of "WorkspaceTagOperationLink_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagOperationLinkResource + ServiceWorkspaceTagOperationLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagOperationLinks(); + + // invoke the operation + string operationLinkId = "link1"; + bool result = await collection.ExistsAsync(operationLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagOperationLink.json + // this example is just showing the usage of "WorkspaceTagOperationLink_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagOperationLinkResource + ServiceWorkspaceTagOperationLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagOperationLinks(); + + // invoke the operation + string operationLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(operationLinkId); + ServiceWorkspaceTagOperationLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceTagOperationLink.json + // this example is just showing the usage of "WorkspaceTagOperationLink_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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagOperationLinkResource + ServiceWorkspaceTagOperationLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagOperationLinks(); + + // invoke the operation + string operationLinkId = "link1"; + TagOperationLinkContractData data = new TagOperationLinkContractData() + { + OperationId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api/operations/op1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, operationLinkId, data); + ServiceWorkspaceTagOperationLinkResource 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagOperationLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagOperationLinkResource.cs new file mode 100644 index 000000000000..9fd2ca9f0bbf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagOperationLinkResource.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceTagOperationLinkResource + { + // ApiManagementGetWorkspaceTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagOperationLink.json + // this example is just showing the usage of "WorkspaceTagOperationLink_Get" 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 ServiceWorkspaceTagOperationLinkResource created on azure + // for more information of creating ServiceWorkspaceTagOperationLinkResource, please refer to the document of ServiceWorkspaceTagOperationLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + string operationLinkId = "link1"; + ResourceIdentifier serviceWorkspaceTagOperationLinkResourceId = ServiceWorkspaceTagOperationLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + ServiceWorkspaceTagOperationLinkResource serviceWorkspaceTagOperationLink = client.GetServiceWorkspaceTagOperationLinkResource(serviceWorkspaceTagOperationLinkResourceId); + + // invoke the operation + ServiceWorkspaceTagOperationLinkResource result = await serviceWorkspaceTagOperationLink.GetAsync(); + + // 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceTagOperationLink.json + // this example is just showing the usage of "WorkspaceTagOperationLink_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 ServiceWorkspaceTagOperationLinkResource created on azure + // for more information of creating ServiceWorkspaceTagOperationLinkResource, please refer to the document of ServiceWorkspaceTagOperationLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + string operationLinkId = "link1"; + ResourceIdentifier serviceWorkspaceTagOperationLinkResourceId = ServiceWorkspaceTagOperationLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + ServiceWorkspaceTagOperationLinkResource serviceWorkspaceTagOperationLink = client.GetServiceWorkspaceTagOperationLinkResource(serviceWorkspaceTagOperationLinkResourceId); + + // invoke the operation + TagOperationLinkContractData data = new TagOperationLinkContractData() + { + OperationId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api/operations/op1", + }; + ArmOperation lro = await serviceWorkspaceTagOperationLink.UpdateAsync(WaitUntil.Completed, data); + ServiceWorkspaceTagOperationLinkResource 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 + TagOperationLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceTagOperationLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceTagOperationLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceTagOperationLink.json + // this example is just showing the usage of "WorkspaceTagOperationLink_Delete" 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 ServiceWorkspaceTagOperationLinkResource created on azure + // for more information of creating ServiceWorkspaceTagOperationLinkResource, please refer to the document of ServiceWorkspaceTagOperationLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + string operationLinkId = "link1"; + ResourceIdentifier serviceWorkspaceTagOperationLinkResourceId = ServiceWorkspaceTagOperationLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + ServiceWorkspaceTagOperationLinkResource serviceWorkspaceTagOperationLink = client.GetServiceWorkspaceTagOperationLinkResource(serviceWorkspaceTagOperationLinkResourceId); + + // invoke the operation + await serviceWorkspaceTagOperationLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagProductLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagProductLinkCollection.cs new file mode 100644 index 000000000000..292edd7c5575 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagProductLinkCollection.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceTagProductLinkCollection + { + // ApiManagementListWorkspaceTagProductLinks + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaceTagProductLinks() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaceTagProductLinks.json + // this example is just showing the usage of "WorkspaceTagProductLink_ListByProduct" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagProductLinkResource + ServiceWorkspaceTagProductLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagProductLinks(); + + // invoke the operation and iterate over the result + await foreach (ServiceWorkspaceTagProductLinkResource item in collection.GetAllAsync()) + { + // the variable item 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 + TagProductLinkContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspaceTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagProductLink.json + // this example is just showing the usage of "WorkspaceTagProductLink_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagProductLinkResource + ServiceWorkspaceTagProductLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagProductLinks(); + + // invoke the operation + string productLinkId = "link1"; + ServiceWorkspaceTagProductLinkResource result = await collection.GetAsync(productLinkId); + + // 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspaceTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspaceTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagProductLink.json + // this example is just showing the usage of "WorkspaceTagProductLink_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagProductLinkResource + ServiceWorkspaceTagProductLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagProductLinks(); + + // invoke the operation + string productLinkId = "link1"; + bool result = await collection.ExistsAsync(productLinkId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspaceTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagProductLink.json + // this example is just showing the usage of "WorkspaceTagProductLink_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagProductLinkResource + ServiceWorkspaceTagProductLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagProductLinks(); + + // invoke the operation + string productLinkId = "link1"; + NullableResponse response = await collection.GetIfExistsAsync(productLinkId); + ServiceWorkspaceTagProductLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspaceTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspaceTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceTagProductLink.json + // this example is just showing the usage of "WorkspaceTagProductLink_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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // get the collection of this ServiceWorkspaceTagProductLinkResource + ServiceWorkspaceTagProductLinkCollection collection = serviceWorkspaceTag.GetServiceWorkspaceTagProductLinks(); + + // invoke the operation + string productLinkId = "link1"; + TagProductLinkContractData data = new TagProductLinkContractData() + { + ProductId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/products/product1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, productLinkId, data); + ServiceWorkspaceTagProductLinkResource 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagProductLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagProductLinkResource.cs new file mode 100644 index 000000000000..de844cbb5965 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagProductLinkResource.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceTagProductLinkResource + { + // ApiManagementGetWorkspaceTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTagProductLink.json + // this example is just showing the usage of "WorkspaceTagProductLink_Get" 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 ServiceWorkspaceTagProductLinkResource created on azure + // for more information of creating ServiceWorkspaceTagProductLinkResource, please refer to the document of ServiceWorkspaceTagProductLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + string productLinkId = "link1"; + ResourceIdentifier serviceWorkspaceTagProductLinkResourceId = ServiceWorkspaceTagProductLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + ServiceWorkspaceTagProductLinkResource serviceWorkspaceTagProductLink = client.GetServiceWorkspaceTagProductLinkResource(serviceWorkspaceTagProductLinkResourceId); + + // invoke the operation + ServiceWorkspaceTagProductLinkResource result = await serviceWorkspaceTagProductLink.GetAsync(); + + // 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementCreateWorkspaceTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementCreateWorkspaceTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspaceTagProductLink.json + // this example is just showing the usage of "WorkspaceTagProductLink_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 ServiceWorkspaceTagProductLinkResource created on azure + // for more information of creating ServiceWorkspaceTagProductLinkResource, please refer to the document of ServiceWorkspaceTagProductLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + string productLinkId = "link1"; + ResourceIdentifier serviceWorkspaceTagProductLinkResourceId = ServiceWorkspaceTagProductLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + ServiceWorkspaceTagProductLinkResource serviceWorkspaceTagProductLink = client.GetServiceWorkspaceTagProductLinkResource(serviceWorkspaceTagProductLinkResourceId); + + // invoke the operation + TagProductLinkContractData data = new TagProductLinkContractData() + { + ProductId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/products/product1", + }; + ArmOperation lro = await serviceWorkspaceTagProductLink.UpdateAsync(WaitUntil.Completed, data); + ServiceWorkspaceTagProductLinkResource 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 + TagProductLinkContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspaceTagProductLink + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceTagProductLink() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceTagProductLink.json + // this example is just showing the usage of "WorkspaceTagProductLink_Delete" 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 ServiceWorkspaceTagProductLinkResource created on azure + // for more information of creating ServiceWorkspaceTagProductLinkResource, please refer to the document of ServiceWorkspaceTagProductLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tag1"; + string productLinkId = "link1"; + ResourceIdentifier serviceWorkspaceTagProductLinkResourceId = ServiceWorkspaceTagProductLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + ServiceWorkspaceTagProductLinkResource serviceWorkspaceTagProductLink = client.GetServiceWorkspaceTagProductLinkResource(serviceWorkspaceTagProductLinkResourceId); + + // invoke the operation + await serviceWorkspaceTagProductLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagResource.cs new file mode 100644 index 000000000000..a3ea91251343 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_ServiceWorkspaceTagResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_ServiceWorkspaceTagResource + { + // ApiManagementHeadWorkspaceTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityState_ApiManagementHeadWorkspaceTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspaceTag.json + // this example is just showing the usage of "WorkspaceTag_GetEntityState" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "59306a29e4bbd510dc24e5f9"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // invoke the operation + bool result = await serviceWorkspaceTag.GetEntityStateAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspaceTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspaceTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspaceTag.json + // this example is just showing the usage of "WorkspaceTag_Get" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "59306a29e4bbd510dc24e5f9"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // invoke the operation + ServiceWorkspaceTagResource result = await serviceWorkspaceTag.GetAsync(); + + // 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}"); + } + + // ApiManagementUpdateWorkspaceTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspaceTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspaceTag.json + // this example is just showing the usage of "WorkspaceTag_Update" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "temptag"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + ApiManagementTagCreateOrUpdateContent content = new ApiManagementTagCreateOrUpdateContent() + { + DisplayName = "temp tag", + }; + ServiceWorkspaceTagResource result = await serviceWorkspaceTag.UpdateAsync(ifMatch, content); + + // 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}"); + } + + // ApiManagementDeleteWorkspaceTag + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspaceTag() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspaceTag.json + // this example is just showing the usage of "WorkspaceTag_Delete" 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 ServiceWorkspaceTagResource created on azure + // for more information of creating ServiceWorkspaceTagResource, please refer to the document of ServiceWorkspaceTagResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + string tagId = "tagId1"; + ResourceIdentifier serviceWorkspaceTagResourceId = ServiceWorkspaceTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + ServiceWorkspaceTagResource serviceWorkspaceTag = client.GetServiceWorkspaceTagResource(serviceWorkspaceTagResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await serviceWorkspaceTag.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 3d0e604d259c..e50c560be5d0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -23,7 +23,7 @@ public partial class Sample_SubscriptionResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetApiManagementSkus_ListsAllAvailableResourceSKUs() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSku.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListSku.json // this example is just showing the usage of "ApiManagementSkus_List" 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 @@ -33,7 +33,7 @@ public async Task GetApiManagementSkus_ListsAllAvailableResourceSKUs() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoCollection.cs index e388b789d238..9b7c7e9870d5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_TenantAccessInfoCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ApiManagementListTenantAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListTenantAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListTenantAccess.json // this example is just showing the usage of "TenantAccess_ListByService" 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 @@ -33,7 +33,7 @@ public async Task GetAll_ApiManagementListTenantAccess() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -60,7 +60,7 @@ public async Task GetAll_ApiManagementListTenantAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTenantAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantAccess.json // this example is just showing the usage of "TenantAccess_Get" 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 @@ -70,7 +70,7 @@ public async Task Get_ApiManagementGetTenantAccess() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -95,7 +95,7 @@ public async Task Get_ApiManagementGetTenantAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetTenantAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantAccess.json // this example is just showing the usage of "TenantAccess_Get" 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 @@ -105,7 +105,7 @@ public async Task Exists_ApiManagementGetTenantAccess() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -126,7 +126,7 @@ public async Task Exists_ApiManagementGetTenantAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetTenantAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantAccess.json // this example is just showing the usage of "TenantAccess_Get" 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 @@ -136,7 +136,7 @@ public async Task GetIfExists_ApiManagementGetTenantAccess() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -169,7 +169,7 @@ public async Task GetIfExists_ApiManagementGetTenantAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTenantGitAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantGitAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantGitAccess.json // this example is just showing the usage of "TenantAccess_Get" 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 @@ -179,7 +179,7 @@ public async Task Get_ApiManagementGetTenantGitAccess() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -204,7 +204,7 @@ public async Task Get_ApiManagementGetTenantGitAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApiManagementGetTenantGitAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantGitAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantGitAccess.json // this example is just showing the usage of "TenantAccess_Get" 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 @@ -214,7 +214,7 @@ public async Task Exists_ApiManagementGetTenantGitAccess() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -235,7 +235,7 @@ public async Task Exists_ApiManagementGetTenantGitAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApiManagementGetTenantGitAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantGitAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantGitAccess.json // this example is just showing the usage of "TenantAccess_Get" 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 @@ -245,7 +245,7 @@ public async Task GetIfExists_ApiManagementGetTenantGitAccess() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); @@ -278,7 +278,7 @@ public async Task GetIfExists_ApiManagementGetTenantGitAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApiManagementCreateTenantAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementCreateTenantAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateTenantAccess.json // this example is just showing the usage of "TenantAccess_Create" 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 @@ -288,7 +288,7 @@ public async Task CreateOrUpdate_ApiManagementCreateTenantAccess() // 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 = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoResource.cs index 38dba2ba35f0..e0f7b66db5a3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_TenantAccessInfoResource.cs @@ -23,7 +23,7 @@ public partial class Sample_TenantAccessInfoResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEntityTag_ApiManagementHeadTenantAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementHeadTenantAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadTenantAccess.json // this example is just showing the usage of "TenantAccess_GetEntityTag" 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 @@ -33,7 +33,7 @@ public async Task GetEntityTag_ApiManagementHeadTenantAccess() // this example assumes you already have this TenantAccessInfoResource created on azure // for more information of creating TenantAccessInfoResource, please refer to the document of TenantAccessInfoResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; AccessName accessName = AccessName.TenantAccess; @@ -51,7 +51,7 @@ public async Task GetEntityTag_ApiManagementHeadTenantAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTenantAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantAccess.json // this example is just showing the usage of "TenantAccess_Get" 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 @@ -61,7 +61,7 @@ public async Task Get_ApiManagementGetTenantAccess() // this example assumes you already have this TenantAccessInfoResource created on azure // for more information of creating TenantAccessInfoResource, please refer to the document of TenantAccessInfoResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; AccessName accessName = AccessName.TenantAccess; @@ -83,7 +83,7 @@ public async Task Get_ApiManagementGetTenantAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApiManagementGetTenantGitAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetTenantGitAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetTenantGitAccess.json // this example is just showing the usage of "TenantAccess_Get" 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 @@ -93,7 +93,7 @@ public async Task Get_ApiManagementGetTenantGitAccess() // this example assumes you already have this TenantAccessInfoResource created on azure // for more information of creating TenantAccessInfoResource, please refer to the document of TenantAccessInfoResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; AccessName accessName = AccessName.TenantGitAccess; @@ -115,7 +115,7 @@ public async Task Get_ApiManagementGetTenantGitAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApiManagementUpdateTenantAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementUpdateTenantAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateTenantAccess.json // this example is just showing the usage of "TenantAccess_Update" 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 @@ -125,7 +125,7 @@ public async Task Update_ApiManagementUpdateTenantAccess() // this example assumes you already have this TenantAccessInfoResource created on azure // for more information of creating TenantAccessInfoResource, please refer to the document of TenantAccessInfoResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; AccessName accessName = AccessName.TenantAccess; @@ -152,7 +152,7 @@ public async Task Update_ApiManagementUpdateTenantAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegeneratePrimaryKey_ApiManagementTenantAccessRegenerateKey() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessRegenerateKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementTenantAccessRegenerateKey.json // this example is just showing the usage of "TenantAccess_RegeneratePrimaryKey" 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 @@ -162,7 +162,7 @@ public async Task RegeneratePrimaryKey_ApiManagementTenantAccessRegenerateKey() // this example assumes you already have this TenantAccessInfoResource created on azure // for more information of creating TenantAccessInfoResource, please refer to the document of TenantAccessInfoResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; AccessName accessName = AccessName.TenantAccess; @@ -180,7 +180,7 @@ public async Task RegeneratePrimaryKey_ApiManagementTenantAccessRegenerateKey() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegenerateSecondaryKey_ApiManagementTenantAccessRegenerateKey() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessRegenerateKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementTenantAccessRegenerateKey.json // this example is just showing the usage of "TenantAccess_RegenerateSecondaryKey" 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 @@ -190,7 +190,7 @@ public async Task RegenerateSecondaryKey_ApiManagementTenantAccessRegenerateKey( // this example assumes you already have this TenantAccessInfoResource created on azure // for more information of creating TenantAccessInfoResource, please refer to the document of TenantAccessInfoResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; AccessName accessName = AccessName.TenantAccess; @@ -208,7 +208,7 @@ public async Task RegenerateSecondaryKey_ApiManagementTenantAccessRegenerateKey( [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSecrets_ApiManagementListSecretsTenantAccess() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementListSecretsTenantAccess.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListSecretsTenantAccess.json // this example is just showing the usage of "TenantAccess_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 @@ -218,7 +218,7 @@ public async Task GetSecrets_ApiManagementListSecretsTenantAccess() // this example assumes you already have this TenantAccessInfoResource created on azure // for more information of creating TenantAccessInfoResource, please refer to the document of TenantAccessInfoResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; AccessName accessName = AccessName.TenantAccess; @@ -236,7 +236,7 @@ public async Task GetSecrets_ApiManagementListSecretsTenantAccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegeneratePrimaryKeyForGit_ApiManagementTenantAccessRegenerateKey() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessRegenerateKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementTenantAccessRegenerateKey.json // this example is just showing the usage of "TenantAccessGit_RegeneratePrimaryKey" 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 @@ -246,7 +246,7 @@ public async Task RegeneratePrimaryKeyForGit_ApiManagementTenantAccessRegenerate // this example assumes you already have this TenantAccessInfoResource created on azure // for more information of creating TenantAccessInfoResource, please refer to the document of TenantAccessInfoResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; AccessName accessName = AccessName.TenantAccess; @@ -264,7 +264,7 @@ public async Task RegeneratePrimaryKeyForGit_ApiManagementTenantAccessRegenerate [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegenerateSecondaryKeyForGit_ApiManagementTenantAccessRegenerateKey() { - // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementTenantAccessRegenerateKey.json + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementTenantAccessRegenerateKey.json // this example is just showing the usage of "TenantAccessGit_RegenerateSecondaryKey" 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 @@ -274,7 +274,7 @@ public async Task RegenerateSecondaryKeyForGit_ApiManagementTenantAccessRegenera // this example assumes you already have this TenantAccessInfoResource created on azure // for more information of creating TenantAccessInfoResource, please refer to the document of TenantAccessInfoResource - string subscriptionId = "subid"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "rg1"; string serviceName = "apimService1"; AccessName accessName = AccessName.TenantAccess; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_WorkspaceContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_WorkspaceContractCollection.cs new file mode 100644 index 000000000000..0b3324b8c4d1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_WorkspaceContractCollection.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_WorkspaceContractCollection + { + // ApiManagementListWorkspaces + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ApiManagementListWorkspaces() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementListWorkspaces.json + // this example is just showing the usage of "Workspace_ListByService" 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 WorkspaceContractResource + WorkspaceContractCollection collection = apiManagementService.GetWorkspaceContracts(); + + // invoke the operation and iterate over the result + await foreach (WorkspaceContractResource item in collection.GetAllAsync()) + { + // the variable item 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 + WorkspaceContractData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ApiManagementGetWorkspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspace() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspace.json + // this example is just showing the usage of "Workspace_Get" 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 WorkspaceContractResource + WorkspaceContractCollection collection = apiManagementService.GetWorkspaceContracts(); + + // invoke the operation + string workspaceId = "wks1"; + WorkspaceContractResource result = await collection.GetAsync(workspaceId); + + // 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 + WorkspaceContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementGetWorkspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ApiManagementGetWorkspace() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspace.json + // this example is just showing the usage of "Workspace_Get" 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 WorkspaceContractResource + WorkspaceContractCollection collection = apiManagementService.GetWorkspaceContracts(); + + // invoke the operation + string workspaceId = "wks1"; + bool result = await collection.ExistsAsync(workspaceId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ApiManagementGetWorkspace() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspace.json + // this example is just showing the usage of "Workspace_Get" 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 WorkspaceContractResource + WorkspaceContractCollection collection = apiManagementService.GetWorkspaceContracts(); + + // invoke the operation + string workspaceId = "wks1"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceId); + WorkspaceContractResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + WorkspaceContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ApiManagementCreateWorkspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApiManagementCreateWorkspace() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementCreateWorkspace.json + // this example is just showing the usage of "Workspace_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 WorkspaceContractResource + WorkspaceContractCollection collection = apiManagementService.GetWorkspaceContracts(); + + // invoke the operation + string workspaceId = "wks1"; + WorkspaceContractData data = new WorkspaceContractData() + { + DisplayName = "my workspace", + Description = "workspace 1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workspaceId, data); + WorkspaceContractResource 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 + WorkspaceContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_WorkspaceContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_WorkspaceContractResource.cs new file mode 100644 index 000000000000..60dde1737e53 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/samples/Generated/Samples/Sample_WorkspaceContractResource.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Samples +{ + public partial class Sample_WorkspaceContractResource + { + // ApiManagementHeadWorkspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEntityTag_ApiManagementHeadWorkspace() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementHeadWorkspace.json + // this example is just showing the usage of "Workspace_GetEntityTag" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // invoke the operation + bool result = await workspaceContract.GetEntityTagAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ApiManagementGetWorkspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ApiManagementGetWorkspace() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementGetWorkspace.json + // this example is just showing the usage of "Workspace_Get" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // invoke the operation + WorkspaceContractResource result = await workspaceContract.GetAsync(); + + // 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 + WorkspaceContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementUpdateWorkspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApiManagementUpdateWorkspace() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementUpdateWorkspace.json + // this example is just showing the usage of "Workspace_Update" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + WorkspaceContractData data = new WorkspaceContractData() + { + DisplayName = "my workspace", + Description = "workspace 1", + }; + WorkspaceContractResource result = await workspaceContract.UpdateAsync(ifMatch, data); + + // 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 + WorkspaceContractData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApiManagementDeleteWorkspace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ApiManagementDeleteWorkspace() + { + // Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-05-01-preview/examples/ApiManagementDeleteWorkspace.json + // this example is just showing the usage of "Workspace_Delete" 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 WorkspaceContractResource created on azure + // for more information of creating WorkspaceContractResource, please refer to the document of WorkspaceContractResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string serviceName = "apimService1"; + string workspaceId = "wks1"; + ResourceIdentifier workspaceContractResourceId = WorkspaceContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, workspaceId); + WorkspaceContractResource workspaceContract = client.GetWorkspaceContractResource(workspaceContractResourceId); + + // invoke the operation + ETag ifMatch = new ETag("*"); + await workspaceContract.DeleteAsync(WaitUntil.Completed, ifMatch); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiData.cs index 64569da0c057..931f10850505 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiData.cs @@ -51,7 +51,8 @@ public ApiData() /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. - internal ApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet) : base(id, name, resourceType, systemData) + /// The provisioning state. + internal ApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet, string provisioningState) : base(id, name, resourceType, systemData) { Description = description; AuthenticationSettings = authenticationSettings; @@ -74,6 +75,7 @@ internal ApiData(ResourceIdentifier id, string name, ResourceType resourceType, Path = path; Protocols = protocols; ApiVersionSet = apiVersionSet; + ProvisioningState = provisioningState; } /// Description of the API. May include HTML formatting tags. @@ -118,5 +120,7 @@ internal ApiData(ResourceIdentifier id, string name, ResourceType resourceType, public IList Protocols { get; } /// Version set details. public ApiVersionSetContractDetails ApiVersionSet { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs index 8025d1dabfa8..d875e2f387d4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs @@ -21,8 +21,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiDiagnostics method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiDiagnostics method from an instance of . /// public partial class ApiDiagnosticCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -49,8 +49,8 @@ internal ApiDiagnosticCollection(ArmClient client, ResourceIdentifier id) : base internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs index 6d877fc930fb..db4de4771c02 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiDiagnostic along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiDiagnosticResource method. - /// Otherwise you can get one from its parent resource using the GetApiDiagnostic method. + /// Otherwise you can get one from its parent resource using the GetApiDiagnostic method. /// public partial class ApiDiagnosticResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs index ad0fc442671b..1ba5a2ea3eb7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs @@ -21,8 +21,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiIssues method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiIssues method from an instance of . /// public partial class ApiIssueCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -49,8 +49,8 @@ internal ApiIssueCollection(ArmClient client, ResourceIdentifier id) : base(clie internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs index edab5d4b4215..a194f275fbfc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiIssue along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiIssueResource method. - /// Otherwise you can get one from its parent resource using the GetApiIssue method. + /// Otherwise you can get one from its parent resource using the GetApiIssue method. /// public partial class ApiIssueResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs index fa7988c9f7cb..dfa59163f1d2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs @@ -44,12 +44,14 @@ public ApiManagementAuthorizationServerData() /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. /// User-friendly authorization server name. + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. /// Form of an authorization grant, which the client uses to request the access token. /// Client or app id registered with this authorization server. /// Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, bool? useInTestConsole, bool? useInApiDocumentation, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) { Description = description; AuthorizationMethods = authorizationMethods; @@ -62,6 +64,8 @@ internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name ResourceOwnerUsername = resourceOwnerUsername; ResourceOwnerPassword = resourceOwnerPassword; DisplayName = displayName; + UseInTestConsole = useInTestConsole; + UseInApiDocumentation = useInApiDocumentation; ClientRegistrationEndpoint = clientRegistrationEndpoint; AuthorizationEndpoint = authorizationEndpoint; GrantTypes = grantTypes; @@ -91,6 +95,10 @@ internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name public string ResourceOwnerPassword { get; set; } /// User-friendly authorization server name. public string DisplayName { get; set; } + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + public bool? UseInTestConsole { get; set; } + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. + public bool? UseInApiDocumentation { get; set; } /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. public string ClientRegistrationEndpoint { get; set; } /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs index 3da750fba037..a0327e8fe18b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs @@ -6,9 +6,11 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ApiManagement { @@ -30,14 +32,17 @@ public ApiManagementBackendData() /// The systemData. /// Backend Title. /// Backend Description. - /// Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. + /// Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. /// Backend Properties contract. /// Backend Credentials Contract Properties. - /// Backend Proxy Contract Properties. + /// Backend gateway Contract Properties. /// Backend TLS Properties. + /// Backend Circuit Breaker Configuration. + /// + /// Type of the backend. A backend can be either Single or Pool. /// Runtime Url of the Backend. /// Backend communication protocol. - internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string description, Uri resourceUri, BackendProperties properties, BackendCredentialsContract credentials, BackendProxyContract proxy, BackendTlsProperties tls, Uri uri, BackendProtocol? protocol) : base(id, name, resourceType, systemData) + internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string description, Uri resourceUri, BackendProperties properties, BackendCredentialsContract credentials, BackendProxyContract proxy, BackendTlsProperties tls, BackendCircuitBreaker circuitBreaker, BackendBaseParametersPool pool, BackendType? typePropertiesType, Uri uri, BackendProtocol? protocol) : base(id, name, resourceType, systemData) { Title = title; Description = description; @@ -46,6 +51,9 @@ internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceTy Credentials = credentials; Proxy = proxy; Tls = tls; + CircuitBreaker = circuitBreaker; + Pool = pool; + TypePropertiesType = typePropertiesType; Uri = uri; Protocol = protocol; } @@ -54,7 +62,7 @@ internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceTy public string Title { get; set; } /// Backend Description. public string Description { get; set; } - /// Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. + /// Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. public Uri ResourceUri { get; set; } /// Backend Properties contract. internal BackendProperties Properties { get; set; } @@ -72,10 +80,38 @@ public BackendServiceFabricClusterProperties BackendServiceFabricCluster /// Backend Credentials Contract Properties. public BackendCredentialsContract Credentials { get; set; } - /// Backend Proxy Contract Properties. + /// Backend gateway Contract Properties. public BackendProxyContract Proxy { get; set; } /// Backend TLS Properties. public BackendTlsProperties Tls { get; set; } + /// Backend Circuit Breaker Configuration. + internal BackendCircuitBreaker CircuitBreaker { get; set; } + /// The rules for tripping the backend. + public IList CircuitBreakerRules + { + get + { + if (CircuitBreaker is null) + CircuitBreaker = new BackendCircuitBreaker(); + return CircuitBreaker.Rules; + } + } + + /// Gets or sets the pool. + internal BackendBaseParametersPool Pool { get; set; } + /// The list of backend entities belonging to a pool. + public IList PoolServices + { + get + { + if (Pool is null) + Pool = new BackendBaseParametersPool(); + return Pool.Services; + } + } + + /// Type of the backend. A backend can be either Single or Pool. + public BackendType? TypePropertiesType { get; set; } /// Runtime Url of the Backend. public Uri Uri { get; set; } /// Backend communication protocol. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs index 832ce30fceea..ed3b0522a5fa 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs @@ -296,7 +296,7 @@ public virtual Response Update(ETag ifMatch, ApiMa } /// - /// Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + /// Notifies the API Management gateway to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. /// /// /// Request Path @@ -327,7 +327,7 @@ public virtual async Task ReconnectAsync(BackendReconnectContract back } /// - /// Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + /// Notifies the API Management gateway to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. /// /// /// Request Path diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs index 2094af1a013f..a38bc79bcc27 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Globalization; using System.Threading; using System.Threading.Tasks; @@ -602,6 +603,202 @@ public virtual Response GenerateToken(GatewayTokenRequestC } } + /// + /// Action is invalidating all debug credentials issued for gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/invalidateDebugCredentials + /// + /// + /// Operation Id + /// Gateway_InvalidateDebugCredentials + /// + /// + /// + /// The cancellation token to use. + public virtual async Task InvalidateDebugCredentialsAsync(CancellationToken cancellationToken = default) + { + using var scope = _apiManagementGatewayGatewayClientDiagnostics.CreateScope("ApiManagementGatewayResource.InvalidateDebugCredentials"); + scope.Start(); + try + { + var response = await _apiManagementGatewayGatewayRestClient.InvalidateDebugCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Action is invalidating all debug credentials issued for gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/invalidateDebugCredentials + /// + /// + /// Operation Id + /// Gateway_InvalidateDebugCredentials + /// + /// + /// + /// The cancellation token to use. + public virtual Response InvalidateDebugCredentials(CancellationToken cancellationToken = default) + { + using var scope = _apiManagementGatewayGatewayClientDiagnostics.CreateScope("ApiManagementGatewayResource.InvalidateDebugCredentials"); + scope.Start(); + try + { + var response = _apiManagementGatewayGatewayRestClient.InvalidateDebugCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create new debug credentials for gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listDebugCredentials + /// + /// + /// Operation Id + /// Gateway_ListDebugCredentials + /// + /// + /// + /// List debug credentials properties. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetDebugCredentialsAsync(GatewayListDebugCredentialsContract gatewayListDebugCredentialsContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(gatewayListDebugCredentialsContract, nameof(gatewayListDebugCredentialsContract)); + + using var scope = _apiManagementGatewayGatewayClientDiagnostics.CreateScope("ApiManagementGatewayResource.GetDebugCredentials"); + scope.Start(); + try + { + var response = await _apiManagementGatewayGatewayRestClient.ListDebugCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gatewayListDebugCredentialsContract, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create new debug credentials for gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listDebugCredentials + /// + /// + /// Operation Id + /// Gateway_ListDebugCredentials + /// + /// + /// + /// List debug credentials properties. + /// The cancellation token to use. + /// is null. + public virtual Response GetDebugCredentials(GatewayListDebugCredentialsContract gatewayListDebugCredentialsContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(gatewayListDebugCredentialsContract, nameof(gatewayListDebugCredentialsContract)); + + using var scope = _apiManagementGatewayGatewayClientDiagnostics.CreateScope("ApiManagementGatewayResource.GetDebugCredentials"); + scope.Start(); + try + { + var response = _apiManagementGatewayGatewayRestClient.ListDebugCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gatewayListDebugCredentialsContract, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Fetches trace collected by gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listTrace + /// + /// + /// Operation Id + /// Gateway_ListTrace + /// + /// + /// + /// List trace properties. + /// The cancellation token to use. + /// is null. + public virtual async Task>> GetTraceAsync(GatewayListTraceContract gatewayListTraceContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(gatewayListTraceContract, nameof(gatewayListTraceContract)); + + using var scope = _apiManagementGatewayGatewayClientDiagnostics.CreateScope("ApiManagementGatewayResource.GetTrace"); + scope.Start(); + try + { + var response = await _apiManagementGatewayGatewayRestClient.ListTraceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gatewayListTraceContract, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Fetches trace collected by gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listTrace + /// + /// + /// Operation Id + /// Gateway_ListTrace + /// + /// + /// + /// List trace properties. + /// The cancellation token to use. + /// is null. + public virtual Response> GetTrace(GatewayListTraceContract gatewayListTraceContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(gatewayListTraceContract, nameof(gatewayListTraceContract)); + + using var scope = _apiManagementGatewayGatewayClientDiagnostics.CreateScope("ApiManagementGatewayResource.GetTrace"); + scope.Start(); + try + { + var response = _apiManagementGatewayGatewayRestClient.ListTrace(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, gatewayListTraceContract, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Lists a collection of the APIs associated with a gateway. /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaData.cs index d9fcc2e9d486..4e69540e15b1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaData.cs @@ -32,12 +32,14 @@ public ApiManagementGlobalSchemaData() /// Free-form schema entity description. /// Json-encoded string for non json-based schema. /// Global Schema document object for json-based schema formats(e.g. json schema). - internal ApiManagementGlobalSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiSchemaType? schemaType, string description, BinaryData value, BinaryData document) : base(id, name, resourceType, systemData) + /// The provisioning state. + internal ApiManagementGlobalSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiSchemaType? schemaType, string description, BinaryData value, BinaryData document, string provisioningState) : base(id, name, resourceType, systemData) { SchemaType = schemaType; Description = description; Value = value; Document = document; + ProvisioningState = provisioningState; } /// Schema Type. Immutable. @@ -106,5 +108,7 @@ internal ApiManagementGlobalSchemaData(ResourceIdentifier id, string name, Resou /// /// public BinaryData Document { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs index a84641556619..e86160266a38 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs @@ -37,9 +37,10 @@ public ApiManagementIdentityProviderData() /// Signin Policy Name. Only applies to AAD B2C Identity Provider. /// Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientLibrary, string clientId, string clientSecret) : base(id, name, resourceType, systemData) { IdentityProviderType = identityProviderType; SignInTenant = signInTenant; @@ -49,6 +50,7 @@ internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, R SignInPolicyName = signInPolicyName; ProfileEditingPolicyName = profileEditingPolicyName; PasswordResetPolicyName = passwordResetPolicyName; + ClientLibrary = clientLibrary; ClientId = clientId; ClientSecret = clientSecret; } @@ -69,6 +71,8 @@ internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, R public string ProfileEditingPolicyName { get; set; } /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. public string PasswordResetPolicyName { get; set; } + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + public string ClientLibrary { get; set; } /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. public string ClientId { get; set; } /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueData.cs index 5d745323812a..1cd7a5288dda 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueData.cs @@ -34,13 +34,15 @@ public ApiManagementNamedValueData() /// Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. /// Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// KeyVault location details of the namedValue. - internal ApiManagementNamedValueData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractProperties keyVaultDetails) : base(id, name, resourceType, systemData) + /// The provisioning state. + internal ApiManagementNamedValueData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractProperties keyVaultDetails, string provisioningState) : base(id, name, resourceType, systemData) { Tags = tags; IsSecret = isSecret; DisplayName = displayName; Value = value; KeyVaultDetails = keyVaultDetails; + ProvisioningState = provisioningState; } /// Optional tags that when provided can be used to filter the NamedValue list. @@ -53,5 +55,7 @@ internal ApiManagementNamedValueData(ResourceIdentifier id, string name, Resourc public string Value { get; set; } /// KeyVault location details of the namedValue. public KeyVaultContractProperties KeyVaultDetails { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs index 8abe85b570c5..19724cc0bd4e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs @@ -31,13 +31,17 @@ public ApiManagementOpenIdConnectProviderData() /// Metadata endpoint URI. /// Client ID of developer console which is the client application. /// Client Secret of developer console which is the client application. - internal ApiManagementOpenIdConnectProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, string metadataEndpoint, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + /// If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided. + /// If true, the Open ID Connect provider will be used in the API documentation in the developer portal. False by default if no value is provided. + internal ApiManagementOpenIdConnectProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, string metadataEndpoint, string clientId, string clientSecret, bool? useInTestConsole, bool? useInApiDocumentation) : base(id, name, resourceType, systemData) { DisplayName = displayName; Description = description; MetadataEndpoint = metadataEndpoint; ClientId = clientId; ClientSecret = clientSecret; + UseInTestConsole = useInTestConsole; + UseInApiDocumentation = useInApiDocumentation; } /// User-friendly OpenID Connect Provider name. @@ -50,5 +54,9 @@ internal ApiManagementOpenIdConnectProviderData(ResourceIdentifier id, string na public string ClientId { get; set; } /// Client Secret of developer console which is the client application. public string ClientSecret { get; set; } + /// If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided. + public bool? UseInTestConsole { get; set; } + /// If true, the Open ID Connect provider will be used in the API documentation in the developer portal. False by default if no value is provided. + public bool? UseInApiDocumentation { get; set; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs index 9fe31fbe5438..cc26bbfc2189 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs @@ -220,7 +220,8 @@ public virtual Response Get(PolicyName policyId, Po public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPolicyPolicyRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ApiManagementPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementPolicyPolicyClientDiagnostics, Pipeline, "ApiManagementPolicyCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementPolicyPolicyRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementPolicyPolicyClientDiagnostics, Pipeline, "ApiManagementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -241,7 +242,8 @@ public virtual AsyncPageable GetAllAsync(Cancellati public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPolicyPolicyRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ApiManagementPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementPolicyPolicyClientDiagnostics, Pipeline, "ApiManagementPolicyCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementPolicyPolicyRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementPolicyPolicyClientDiagnostics, Pipeline, "ApiManagementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionData.cs index bbac1aff9556..afe5a0b975dc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionData.cs @@ -34,7 +34,8 @@ public ApiManagementPortalRevisionData() /// Indicates if the portal's revision is public. /// Portal's revision creation date and time. /// Last updated date and time. - internal ApiManagementPortalRevisionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string statusDetails, PortalRevisionStatus? status, bool? isCurrent, DateTimeOffset? createdOn, DateTimeOffset? updatedOn) : base(id, name, resourceType, systemData) + /// The provisioning state. + internal ApiManagementPortalRevisionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string statusDetails, PortalRevisionStatus? status, bool? isCurrent, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, string provisioningState) : base(id, name, resourceType, systemData) { Description = description; StatusDetails = statusDetails; @@ -42,6 +43,7 @@ internal ApiManagementPortalRevisionData(ResourceIdentifier id, string name, Res IsCurrent = isCurrent; CreatedOn = createdOn; UpdatedOn = updatedOn; + ProvisioningState = provisioningState; } /// Portal revision description. @@ -56,5 +58,7 @@ internal ApiManagementPortalRevisionData(ResourceIdentifier id, string name, Res public DateTimeOffset? CreatedOn { get; } /// Last updated date and time. public DateTimeOffset? UpdatedOn { get; } + /// The provisioning state. + public string ProvisioningState { get; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs index f8cbb4bd9a3a..c42ce169b054 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs @@ -22,8 +22,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementProductPolicies method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiManagementProductPolicies method from an instance of . /// public partial class ApiManagementProductPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -50,8 +50,8 @@ internal ApiManagementProductPolicyCollection(ArmClient client, ResourceIdentifi internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiManagementProductResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementProductResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceProductResource.ResourceType), nameof(id)); } /// @@ -220,7 +220,8 @@ public virtual Response Get(PolicyName polic public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductPolicyProductPolicyRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ApiManagementProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementProductPolicyProductPolicyClientDiagnostics, Pipeline, "ApiManagementProductPolicyCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductPolicyProductPolicyRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementProductPolicyProductPolicyClientDiagnostics, Pipeline, "ApiManagementProductPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -241,7 +242,8 @@ public virtual AsyncPageable GetAllAsync(Can public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductPolicyProductPolicyRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ApiManagementProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementProductPolicyProductPolicyClientDiagnostics, Pipeline, "ApiManagementProductPolicyCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductPolicyProductPolicyRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementProductPolicyProductPolicyClientDiagnostics, Pipeline, "ApiManagementProductPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs index 3eb8f23fd4f6..4f7eef956766 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiManagementProductPolicy along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiManagementProductPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementProductPolicy method. + /// Otherwise you can get one from its parent resource using the GetApiManagementProductPolicy method. /// public partial class ApiManagementProductPolicyResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs index bc4d36396502..e2523a2ff913 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs @@ -21,8 +21,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementProductTags method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiManagementProductTags method from an instance of . /// public partial class ApiManagementProductTagCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -49,8 +49,8 @@ internal ApiManagementProductTagCollection(ArmClient client, ResourceIdentifier internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiManagementProductResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementProductResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceProductResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs index fd69fda97f93..d52ed326ceb1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiManagementProductTag along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiManagementProductTagResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementProductTag method. + /// Otherwise you can get one from its parent resource using the GetApiManagementProductTag method. /// public partial class ApiManagementProductTagResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs index e53704adf04c..008b35f6bfba 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs @@ -41,6 +41,7 @@ public ApiManagementServiceData(AzureLocation location, ApiManagementServiceSkuP AdditionalLocations = new ChangeTrackingList(); CustomProperties = new ChangeTrackingDictionary(); Certificates = new ChangeTrackingList(); + OutboundPublicIPAddresses = new ChangeTrackingList(); PrivateEndpointConnections = new ChangeTrackingList(); PublisherEmail = publisherEmail; PublisherName = publisherName; @@ -72,20 +73,25 @@ public ApiManagementServiceData(AzureLocation location, ApiManagementServiceSkuP /// Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. /// Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network. /// Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + /// Configuration API configuration of the API Management service. /// Virtual network configuration of the API Management service. /// Additional datacenter locations of the API Management service. - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + /// Property can be used to enable NAT Gateway for this API Management service. + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. /// Control Plane Apis version constraint for the API Management service. /// Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. /// List of Private Endpoint Connections of this service. /// Compute Platform Version running the service in this location. + /// Status of legacy portal in the API Management service. + /// Status of developer portal in this API Management service. /// Publisher email. /// Publisher name. - internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName) : base(id, name, resourceType, systemData, tags, location) + internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, ConfigurationApi configurationApi, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, NatGatewayState? natGatewayState, IReadOnlyList outboundPublicIPAddresses, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, LegacyPortalStatus? legacyPortalStatus, DeveloperPortalStatus? developerPortalStatus, string publisherEmail, string publisherName) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Identity = identity; @@ -106,17 +112,22 @@ internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceTy PrivateIPAddresses = privateIPAddresses; PublicIPAddressId = publicIPAddressId; PublicNetworkAccess = publicNetworkAccess; + ConfigurationApi = configurationApi; VirtualNetworkConfiguration = virtualNetworkConfiguration; AdditionalLocations = additionalLocations; CustomProperties = customProperties; Certificates = certificates; EnableClientCertificate = enableClientCertificate; + NatGatewayState = natGatewayState; + OutboundPublicIPAddresses = outboundPublicIPAddresses; DisableGateway = disableGateway; VirtualNetworkType = virtualNetworkType; ApiVersionConstraint = apiVersionConstraint; Restore = restore; PrivateEndpointConnections = privateEndpointConnections; PlatformVersion = platformVersion; + LegacyPortalStatus = legacyPortalStatus; + DeveloperPortalStatus = developerPortalStatus; PublisherEmail = publisherEmail; PublisherName = publisherName; } @@ -159,16 +170,34 @@ internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceTy public ResourceIdentifier PublicIPAddressId { get; set; } /// Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. public PublicNetworkAccess? PublicNetworkAccess { get; set; } + /// Configuration API configuration of the API Management service. + internal ConfigurationApi ConfigurationApi { get; set; } + /// Indication whether or not the legacy Configuration API (v1) should be exposed on the API Management service. Value is optional but must be 'Enabled' or 'Disabled'. If 'Disabled', legacy Configuration API (v1) will not be available for self-hosted gateways. Default value is 'Enabled'. + public LegacyApiState? LegacyApi + { + get => ConfigurationApi is null ? default : ConfigurationApi.LegacyApi; + set + { + if (ConfigurationApi is null) + ConfigurationApi = new ConfigurationApi(); + ConfigurationApi.LegacyApi = value; + } + } + /// Virtual network configuration of the API Management service. public VirtualNetworkConfiguration VirtualNetworkConfiguration { get; set; } /// Additional datacenter locations of the API Management service. public IList AdditionalLocations { get; } - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. public IDictionary CustomProperties { get; } /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. public IList Certificates { get; } /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. public bool? EnableClientCertificate { get; set; } + /// Property can be used to enable NAT Gateway for this API Management service. + public NatGatewayState? NatGatewayState { get; set; } + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. + public IReadOnlyList OutboundPublicIPAddresses { get; } /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. public bool? DisableGateway { get; set; } /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. @@ -193,6 +222,10 @@ public string MinApiVersion public IList PrivateEndpointConnections { get; } /// Compute Platform Version running the service in this location. public PlatformVersion? PlatformVersion { get; } + /// Status of legacy portal in the API Management service. + public LegacyPortalStatus? LegacyPortalStatus { get; set; } + /// Status of developer portal in this API Management service. + public DeveloperPortalStatus? DeveloperPortalStatus { get; set; } /// Publisher email. public string PublisherEmail { get; set; } /// Publisher name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs index ec4b5b265d49..69f26e841ae2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs @@ -40,8 +40,10 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _apiManagementServiceClientDiagnostics; private readonly ApiManagementServiceRestOperations _apiManagementServiceRestClient; - private readonly ClientDiagnostics _apiClientDiagnostics; - private readonly ApiRestOperations _apiRestClient; + private readonly ClientDiagnostics _allPoliciesClientDiagnostics; + private readonly AllPoliciesRestOperations _allPoliciesRestClient; + private readonly ClientDiagnostics _serviceApiApiClientDiagnostics; + private readonly ApiRestOperations _serviceApiApiRestClient; private readonly ClientDiagnostics _defaultClientDiagnostics; private readonly ApiManagementRestOperations _defaultRestClient; private readonly ClientDiagnostics _contentTypeClientDiagnostics; @@ -56,10 +58,12 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly OutboundNetworkDependenciesEndpointsRestOperations _outboundNetworkDependenciesEndpointsRestClient; private readonly ClientDiagnostics _policyDescriptionClientDiagnostics; private readonly PolicyDescriptionRestOperations _policyDescriptionRestClient; + private readonly ClientDiagnostics _policyRestrictionValidationsClientDiagnostics; + private readonly PolicyRestrictionValidationsRestOperations _policyRestrictionValidationsRestClient; private readonly ClientDiagnostics _apiManagementServicePortalSettingsClientDiagnostics; private readonly PortalSettingsRestOperations _apiManagementServicePortalSettingsRestClient; - private readonly ClientDiagnostics _apiManagementProductProductClientDiagnostics; - private readonly ProductRestOperations _apiManagementProductProductRestClient; + private readonly ClientDiagnostics _serviceProductProductClientDiagnostics; + private readonly ProductRestOperations _serviceProductProductRestClient; private readonly ClientDiagnostics _quotaByCounterKeysClientDiagnostics; private readonly QuotaByCounterKeysRestOperations _quotaByCounterKeysRestClient; private readonly ClientDiagnostics _quotaByPeriodKeysClientDiagnostics; @@ -99,9 +103,11 @@ internal ApiManagementServiceResource(ArmClient client, ResourceIdentifier id) : _apiManagementServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string apiManagementServiceApiVersion); _apiManagementServiceRestClient = new ApiManagementServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementServiceApiVersion); - _apiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiResource.ResourceType, out string apiApiVersion); - _apiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiApiVersion); + _allPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _allPoliciesRestClient = new AllPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _serviceApiApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiResource.ResourceType, out string serviceApiApiApiVersion); + _serviceApiApiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiApiApiVersion); _defaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _defaultRestClient = new ApiManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _contentTypeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -116,12 +122,14 @@ internal ApiManagementServiceResource(ArmClient client, ResourceIdentifier id) : _outboundNetworkDependenciesEndpointsRestClient = new OutboundNetworkDependenciesEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _policyDescriptionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _policyDescriptionRestClient = new PolicyDescriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _policyRestrictionValidationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _policyRestrictionValidationsRestClient = new PolicyRestrictionValidationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _apiManagementServicePortalSettingsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string apiManagementServicePortalSettingsApiVersion); _apiManagementServicePortalSettingsRestClient = new PortalSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementServicePortalSettingsApiVersion); - _apiManagementProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementProductResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementProductResource.ResourceType, out string apiManagementProductProductApiVersion); - _apiManagementProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementProductProductApiVersion); + _serviceProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceProductResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceProductResource.ResourceType, out string serviceProductProductApiVersion); + _serviceProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductProductApiVersion); _quotaByCounterKeysClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _quotaByCounterKeysRestClient = new QuotaByCounterKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _quotaByPeriodKeysClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -160,11 +168,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of ApiResources in the ApiManagementService. - /// An object representing collection of ApiResources and their operations over a ApiResource. - public virtual ApiCollection GetApis() + /// Gets a collection of ServiceApiResources in the ApiManagementService. + /// An object representing collection of ServiceApiResources and their operations over a ServiceApiResource. + public virtual ServiceApiCollection GetServiceApis() { - return GetCachedClient(client => new ApiCollection(client, Id)); + return GetCachedClient(client => new ServiceApiCollection(client, Id)); } /// @@ -185,9 +193,9 @@ public virtual ApiCollection GetApis() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetApiAsync(string apiId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiAsync(string apiId, CancellationToken cancellationToken = default) { - return await GetApis().GetAsync(apiId, cancellationToken).ConfigureAwait(false); + return await GetServiceApis().GetAsync(apiId, cancellationToken).ConfigureAwait(false); } /// @@ -208,9 +216,9 @@ public virtual async Task> GetApiAsync(string apiId, Cance /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetApi(string apiId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApi(string apiId, CancellationToken cancellationToken = default) { - return GetApis().Get(apiId, cancellationToken); + return GetServiceApis().Get(apiId, cancellationToken); } /// Gets a collection of ApiManagementPolicyResources in the ApiManagementService. @@ -423,11 +431,11 @@ public virtual Response GetApiManagementIssue(string return GetApiManagementIssues().Get(issueId, cancellationToken); } - /// Gets a collection of ApiVersionSetResources in the ApiManagementService. - /// An object representing collection of ApiVersionSetResources and their operations over a ApiVersionSetResource. - public virtual ApiVersionSetCollection GetApiVersionSets() + /// Gets a collection of ServiceApiVersionSetResources in the ApiManagementService. + /// An object representing collection of ServiceApiVersionSetResources and their operations over a ServiceApiVersionSetResource. + public virtual ServiceApiVersionSetCollection GetServiceApiVersionSets() { - return GetCachedClient(client => new ApiVersionSetCollection(client, Id)); + return GetCachedClient(client => new ServiceApiVersionSetCollection(client, Id)); } /// @@ -448,9 +456,9 @@ public virtual ApiVersionSetCollection GetApiVersionSets() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetApiVersionSetAsync(string versionSetId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiVersionSetAsync(string versionSetId, CancellationToken cancellationToken = default) { - return await GetApiVersionSets().GetAsync(versionSetId, cancellationToken).ConfigureAwait(false); + return await GetServiceApiVersionSets().GetAsync(versionSetId, cancellationToken).ConfigureAwait(false); } /// @@ -471,9 +479,62 @@ public virtual async Task> GetApiVersionSetAsync /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetApiVersionSet(string versionSetId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApiVersionSet(string versionSetId, CancellationToken cancellationToken = default) { - return GetApiVersionSets().Get(versionSetId, cancellationToken); + return GetServiceApiVersionSets().Get(versionSetId, cancellationToken); + } + + /// Gets a collection of AuthorizationProviderContractResources in the ApiManagementService. + /// An object representing collection of AuthorizationProviderContractResources and their operations over a AuthorizationProviderContractResource. + public virtual AuthorizationProviderContractCollection GetAuthorizationProviderContracts() + { + return GetCachedClient(client => new AuthorizationProviderContractCollection(client, Id)); + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAuthorizationProviderContractAsync(string authorizationProviderId, CancellationToken cancellationToken = default) + { + return await GetAuthorizationProviderContracts().GetAsync(authorizationProviderId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAuthorizationProviderContract(string authorizationProviderId, CancellationToken cancellationToken = default) + { + return GetAuthorizationProviderContracts().Get(authorizationProviderId, cancellationToken); } /// Gets a collection of ApiManagementAuthorizationServerResources in the ApiManagementService. @@ -688,6 +749,59 @@ public virtual Response GetApiManagementCertif return GetApiManagementCertificates().Get(certificateId, cancellationToken); } + /// Gets a collection of DocumentationContractResources in the ApiManagementService. + /// An object representing collection of DocumentationContractResources and their operations over a DocumentationContractResource. + public virtual DocumentationContractCollection GetDocumentationContracts() + { + return GetCachedClient(client => new DocumentationContractCollection(client, Id)); + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDocumentationContractAsync(string documentationId, CancellationToken cancellationToken = default) + { + return await GetDocumentationContracts().GetAsync(documentationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDocumentationContract(string documentationId, CancellationToken cancellationToken = default) + { + return GetDocumentationContracts().Get(documentationId, cancellationToken); + } + /// Gets a collection of ApiManagementEmailTemplateResources in the ApiManagementService. /// An object representing collection of ApiManagementEmailTemplateResources and their operations over a ApiManagementEmailTemplateResource. public virtual ApiManagementEmailTemplateCollection GetApiManagementEmailTemplates() @@ -790,11 +904,11 @@ public virtual Response GetApiManagementGateway(st return GetApiManagementGateways().Get(gatewayId, cancellationToken); } - /// Gets a collection of ApiManagementGroupResources in the ApiManagementService. - /// An object representing collection of ApiManagementGroupResources and their operations over a ApiManagementGroupResource. - public virtual ApiManagementGroupCollection GetApiManagementGroups() + /// Gets a collection of ServiceGroupResources in the ApiManagementService. + /// An object representing collection of ServiceGroupResources and their operations over a ServiceGroupResource. + public virtual ServiceGroupCollection GetServiceGroups() { - return GetCachedClient(client => new ApiManagementGroupCollection(client, Id)); + return GetCachedClient(client => new ServiceGroupCollection(client, Id)); } /// @@ -815,9 +929,9 @@ public virtual ApiManagementGroupCollection GetApiManagementGroups() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetApiManagementGroupAsync(string groupId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceGroupAsync(string groupId, CancellationToken cancellationToken = default) { - return await GetApiManagementGroups().GetAsync(groupId, cancellationToken).ConfigureAwait(false); + return await GetServiceGroups().GetAsync(groupId, cancellationToken).ConfigureAwait(false); } /// @@ -838,9 +952,9 @@ public virtual async Task> GetApiManagement /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetApiManagementGroup(string groupId, CancellationToken cancellationToken = default) + public virtual Response GetServiceGroup(string groupId, CancellationToken cancellationToken = default) { - return GetApiManagementGroups().Get(groupId, cancellationToken); + return GetServiceGroups().Get(groupId, cancellationToken); } /// Gets a collection of ApiManagementIdentityProviderResources in the ApiManagementService. @@ -945,11 +1059,11 @@ public virtual Response GetApiManagementLogger(stri return GetApiManagementLoggers().Get(loggerId, cancellationToken); } - /// Gets a collection of ApiManagementNamedValueResources in the ApiManagementService. - /// An object representing collection of ApiManagementNamedValueResources and their operations over a ApiManagementNamedValueResource. - public virtual ApiManagementNamedValueCollection GetApiManagementNamedValues() + /// Gets a collection of ServiceNamedValueResources in the ApiManagementService. + /// An object representing collection of ServiceNamedValueResources and their operations over a ServiceNamedValueResource. + public virtual ServiceNamedValueCollection GetServiceNamedValues() { - return GetCachedClient(client => new ApiManagementNamedValueCollection(client, Id)); + return GetCachedClient(client => new ServiceNamedValueCollection(client, Id)); } /// @@ -970,9 +1084,9 @@ public virtual ApiManagementNamedValueCollection GetApiManagementNamedValues() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetApiManagementNamedValueAsync(string namedValueId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceNamedValueAsync(string namedValueId, CancellationToken cancellationToken = default) { - return await GetApiManagementNamedValues().GetAsync(namedValueId, cancellationToken).ConfigureAwait(false); + return await GetServiceNamedValues().GetAsync(namedValueId, cancellationToken).ConfigureAwait(false); } /// @@ -993,16 +1107,16 @@ public virtual async Task> GetApiManag /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetApiManagementNamedValue(string namedValueId, CancellationToken cancellationToken = default) + public virtual Response GetServiceNamedValue(string namedValueId, CancellationToken cancellationToken = default) { - return GetApiManagementNamedValues().Get(namedValueId, cancellationToken); + return GetServiceNamedValues().Get(namedValueId, cancellationToken); } - /// Gets a collection of ApiManagementNotificationResources in the ApiManagementService. - /// An object representing collection of ApiManagementNotificationResources and their operations over a ApiManagementNotificationResource. - public virtual ApiManagementNotificationCollection GetApiManagementNotifications() + /// Gets a collection of ServiceNotificationResources in the ApiManagementService. + /// An object representing collection of ServiceNotificationResources and their operations over a ServiceNotificationResource. + public virtual ServiceNotificationCollection GetServiceNotifications() { - return GetCachedClient(client => new ApiManagementNotificationCollection(client, Id)); + return GetCachedClient(client => new ServiceNotificationCollection(client, Id)); } /// @@ -1021,9 +1135,9 @@ public virtual ApiManagementNotificationCollection GetApiManagementNotifications /// Notification Name Identifier. /// The cancellation token to use. [ForwardsClientCalls] - public virtual async Task> GetApiManagementNotificationAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceNotificationAsync(NotificationName notificationName, CancellationToken cancellationToken = default) { - return await GetApiManagementNotifications().GetAsync(notificationName, cancellationToken).ConfigureAwait(false); + return await GetServiceNotifications().GetAsync(notificationName, cancellationToken).ConfigureAwait(false); } /// @@ -1042,9 +1156,9 @@ public virtual async Task> GetApiMan /// Notification Name Identifier. /// The cancellation token to use. [ForwardsClientCalls] - public virtual Response GetApiManagementNotification(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual Response GetServiceNotification(NotificationName notificationName, CancellationToken cancellationToken = default) { - return GetApiManagementNotifications().Get(notificationName, cancellationToken); + return GetServiceNotifications().Get(notificationName, cancellationToken); } /// Gets a collection of ApiManagementOpenIdConnectProviderResources in the ApiManagementService. @@ -1100,6 +1214,167 @@ public virtual Response GetApiManage return GetApiManagementOpenIdConnectProviders().Get(openId, cancellationToken); } + /// Gets a collection of ServicePolicyFragmentResources in the ApiManagementService. + /// An object representing collection of ServicePolicyFragmentResources and their operations over a ServicePolicyFragmentResource. + public virtual ServicePolicyFragmentCollection GetServicePolicyFragments() + { + return GetCachedClient(client => new ServicePolicyFragmentCollection(client, Id)); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServicePolicyFragmentAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServicePolicyFragments().GetAsync(id, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServicePolicyFragment(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServicePolicyFragments().Get(id, format, cancellationToken); + } + + /// Gets a collection of PolicyRestrictionContractResources in the ApiManagementService. + /// An object representing collection of PolicyRestrictionContractResources and their operations over a PolicyRestrictionContractResource. + public virtual PolicyRestrictionContractCollection GetPolicyRestrictionContracts() + { + return GetCachedClient(client => new PolicyRestrictionContractCollection(client, Id)); + } + + /// + /// Get the policy restriction of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPolicyRestrictionContractAsync(string policyRestrictionId, CancellationToken cancellationToken = default) + { + return await GetPolicyRestrictionContracts().GetAsync(policyRestrictionId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy restriction of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPolicyRestrictionContract(string policyRestrictionId, CancellationToken cancellationToken = default) + { + return GetPolicyRestrictionContracts().Get(policyRestrictionId, cancellationToken); + } + + /// Gets a collection of PortalConfigContractResources in the ApiManagementService. + /// An object representing collection of PortalConfigContractResources and their operations over a PortalConfigContractResource. + public virtual PortalConfigContractCollection GetPortalConfigContracts() + { + return GetCachedClient(client => new PortalConfigContractCollection(client, Id)); + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPortalConfigContractAsync(string portalConfigId, CancellationToken cancellationToken = default) + { + return await GetPortalConfigContracts().GetAsync(portalConfigId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPortalConfigContract(string portalConfigId, CancellationToken cancellationToken = default) + { + return GetPortalConfigContracts().Get(portalConfigId, cancellationToken); + } + /// Gets a collection of ApiManagementPortalRevisionResources in the ApiManagementService. /// An object representing collection of ApiManagementPortalRevisionResources and their operations over a ApiManagementPortalRevisionResource. public virtual ApiManagementPortalRevisionCollection GetApiManagementPortalRevisions() @@ -1280,11 +1555,11 @@ public virtual Response GetApiManagementPrivat return GetApiManagementPrivateLinkResources().Get(privateLinkSubResourceName, cancellationToken); } - /// Gets a collection of ApiManagementProductResources in the ApiManagementService. - /// An object representing collection of ApiManagementProductResources and their operations over a ApiManagementProductResource. - public virtual ApiManagementProductCollection GetApiManagementProducts() + /// Gets a collection of ServiceProductResources in the ApiManagementService. + /// An object representing collection of ServiceProductResources and their operations over a ServiceProductResource. + public virtual ServiceProductCollection GetServiceProducts() { - return GetCachedClient(client => new ApiManagementProductCollection(client, Id)); + return GetCachedClient(client => new ServiceProductCollection(client, Id)); } /// @@ -1305,9 +1580,9 @@ public virtual ApiManagementProductCollection GetApiManagementProducts() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetApiManagementProductAsync(string productId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceProductAsync(string productId, CancellationToken cancellationToken = default) { - return await GetApiManagementProducts().GetAsync(productId, cancellationToken).ConfigureAwait(false); + return await GetServiceProducts().GetAsync(productId, cancellationToken).ConfigureAwait(false); } /// @@ -1328,16 +1603,16 @@ public virtual async Task> GetApiManageme /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetApiManagementProduct(string productId, CancellationToken cancellationToken = default) + public virtual Response GetServiceProduct(string productId, CancellationToken cancellationToken = default) { - return GetApiManagementProducts().Get(productId, cancellationToken); + return GetServiceProducts().Get(productId, cancellationToken); } - /// Gets a collection of ApiManagementGlobalSchemaResources in the ApiManagementService. - /// An object representing collection of ApiManagementGlobalSchemaResources and their operations over a ApiManagementGlobalSchemaResource. - public virtual ApiManagementGlobalSchemaCollection GetApiManagementGlobalSchemas() + /// Gets a collection of ServiceSchemaResources in the ApiManagementService. + /// An object representing collection of ServiceSchemaResources and their operations over a ServiceSchemaResource. + public virtual ServiceSchemaCollection GetServiceSchemas() { - return GetCachedClient(client => new ApiManagementGlobalSchemaCollection(client, Id)); + return GetCachedClient(client => new ServiceSchemaCollection(client, Id)); } /// @@ -1358,9 +1633,9 @@ public virtual ApiManagementGlobalSchemaCollection GetApiManagementGlobalSchemas /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetApiManagementGlobalSchemaAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceSchemaAsync(string schemaId, CancellationToken cancellationToken = default) { - return await GetApiManagementGlobalSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); + return await GetServiceSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); } /// @@ -1381,9 +1656,9 @@ public virtual async Task> GetApiMan /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetApiManagementGlobalSchema(string schemaId, CancellationToken cancellationToken = default) + public virtual Response GetServiceSchema(string schemaId, CancellationToken cancellationToken = default) { - return GetApiManagementGlobalSchemas().Get(schemaId, cancellationToken); + return GetServiceSchemas().Get(schemaId, cancellationToken); } /// Gets a collection of ApiManagementTenantSettingResources in the ApiManagementService. @@ -1590,6 +1865,59 @@ public virtual Response GetApiManagementUser(string u return GetApiManagementUsers().Get(userId, cancellationToken); } + /// Gets a collection of WorkspaceContractResources in the ApiManagementService. + /// An object representing collection of WorkspaceContractResources and their operations over a WorkspaceContractResource. + public virtual WorkspaceContractCollection GetWorkspaceContracts() + { + return GetCachedClient(client => new WorkspaceContractCollection(client, Id)); + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetWorkspaceContractAsync(string workspaceId, CancellationToken cancellationToken = default) + { + return await GetWorkspaceContracts().GetAsync(workspaceId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetWorkspaceContract(string workspaceId, CancellationToken cancellationToken = default) + { + return GetWorkspaceContracts().Get(workspaceId, cancellationToken); + } + /// /// Gets an API Management service resource description. /// @@ -1798,6 +2126,50 @@ public virtual ArmOperation Update(WaitUntil waitU } } + /// + /// Status of all policies of API Management services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/allPolicies + /// + /// + /// Operation Id + /// AllPolicies_ListByService + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllPoliciesByServiceAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _allPoliciesRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _allPoliciesRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AllPoliciesContract.DeserializeAllPoliciesContract, _allPoliciesClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetAllPoliciesByService", "value", "nextLink", cancellationToken); + } + + /// + /// Status of all policies of API Management services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/allPolicies + /// + /// + /// Operation Id + /// AllPolicies_ListByService + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllPoliciesByService(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _allPoliciesRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _allPoliciesRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AllPoliciesContract.DeserializeAllPoliciesContract, _allPoliciesClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetAllPoliciesByService", "value", "nextLink", cancellationToken); + } + /// /// Lists a collection of apis associated with tags. /// @@ -1819,9 +2191,9 @@ public virtual ArmOperation Update(WaitUntil waitU /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetApisByTagsAsync(string filter = null, int? top = null, int? skip = null, bool? includeNotTaggedApis = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _apiClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetApisByTags", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiApiRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiApiRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _serviceApiApiClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetApisByTags", "value", "nextLink", cancellationToken); } /// @@ -1845,9 +2217,9 @@ public virtual AsyncPageable GetApisByTagsAsync(stri /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetApisByTags(string filter = null, int? top = null, int? skip = null, bool? includeNotTaggedApis = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _apiClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetApisByTags", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiApiRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiApiRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _serviceApiApiClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetApisByTags", "value", "nextLink", cancellationToken); } /// @@ -2054,19 +2426,21 @@ public virtual Response GetContentType(string contentT /// /// /// Content type identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> CreateOrUpdateContentTypeAsync(string contentTypeId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateContentTypeAsync(string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); + Argument.AssertNotNull(apiManagementContentType, nameof(apiManagementContentType)); using var scope = _contentTypeClientDiagnostics.CreateScope("ApiManagementServiceResource.CreateOrUpdateContentType"); scope.Start(); try { - var response = await _contentTypeRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _contentTypeRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, apiManagementContentType, ifMatch, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -2090,19 +2464,21 @@ public virtual async Task> CreateOrUpdateCont /// /// /// Content type identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response CreateOrUpdateContentType(string contentTypeId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual Response CreateOrUpdateContentType(string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); + Argument.AssertNotNull(apiManagementContentType, nameof(apiManagementContentType)); using var scope = _contentTypeClientDiagnostics.CreateScope("ApiManagementServiceResource.CreateOrUpdateContentType"); scope.Start(); try { - var response = _contentTypeRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, ifMatch, cancellationToken); + var response = _contentTypeRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, apiManagementContentType, ifMatch, cancellationToken); return response; } catch (Exception e) @@ -2401,20 +2777,22 @@ public virtual Response GetContentItem(string contentT /// /// Content type identifier. /// Content item identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateContentItemAsync(string contentTypeId, string contentItemId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// , or is null. + public virtual async Task> CreateOrUpdateContentItemAsync(string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); Argument.AssertNotNullOrEmpty(contentItemId, nameof(contentItemId)); + Argument.AssertNotNull(apiManagementContentItem, nameof(apiManagementContentItem)); using var scope = _contentItemClientDiagnostics.CreateScope("ApiManagementServiceResource.CreateOrUpdateContentItem"); scope.Start(); try { - var response = await _contentItemRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, contentItemId, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _contentItemRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, contentItemId, apiManagementContentItem, ifMatch, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -2439,20 +2817,22 @@ public virtual async Task> CreateOrUpdateCont /// /// Content type identifier. /// Content item identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. - /// or is null. - public virtual Response CreateOrUpdateContentItem(string contentTypeId, string contentItemId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// , or is null. + public virtual Response CreateOrUpdateContentItem(string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); Argument.AssertNotNullOrEmpty(contentItemId, nameof(contentItemId)); + Argument.AssertNotNull(apiManagementContentItem, nameof(apiManagementContentItem)); using var scope = _contentItemClientDiagnostics.CreateScope("ApiManagementServiceResource.CreateOrUpdateContentItem"); scope.Start(); try { - var response = _contentItemRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, contentItemId, ifMatch, cancellationToken); + var response = _contentItemRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, contentItemId, apiManagementContentItem, ifMatch, cancellationToken); return response; } catch (Exception e) @@ -2734,6 +3114,76 @@ public virtual ArmOperation Backup(WaitUntil waitU } } + /// + /// Upgrades an API Management service to the Stv2 platform. For details refer to https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation and could take several minutes to complete. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2 + /// + /// + /// Operation Id + /// ApiManagementService_MigrateToStv2 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Optional parameters supplied to migrate service. + /// The cancellation token to use. + public virtual async Task> MigrateToStv2Async(WaitUntil waitUntil, MigrateToStv2Contract migrateToStv2Contract = null, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementServiceClientDiagnostics.CreateScope("ApiManagementServiceResource.MigrateToStv2"); + scope.Start(); + try + { + var response = await _apiManagementServiceRestClient.MigrateToStv2Async(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, migrateToStv2Contract, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ApiManagementServiceOperationSource(Client), _apiManagementServiceClientDiagnostics, Pipeline, _apiManagementServiceRestClient.CreateMigrateToStv2Request(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, migrateToStv2Contract).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Upgrades an API Management service to the Stv2 platform. For details refer to https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation and could take several minutes to complete. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2 + /// + /// + /// Operation Id + /// ApiManagementService_MigrateToStv2 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Optional parameters supplied to migrate service. + /// The cancellation token to use. + public virtual ArmOperation MigrateToStv2(WaitUntil waitUntil, MigrateToStv2Contract migrateToStv2Contract = null, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementServiceClientDiagnostics.CreateScope("ApiManagementServiceResource.MigrateToStv2"); + scope.Start(); + try + { + var response = _apiManagementServiceRestClient.MigrateToStv2(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, migrateToStv2Contract, cancellationToken); + var operation = new ApiManagementArmOperation(new ApiManagementServiceOperationSource(Client), _apiManagementServiceClientDiagnostics, Pipeline, _apiManagementServiceRestClient.CreateMigrateToStv2Request(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, migrateToStv2Contract).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. /// @@ -3054,6 +3504,74 @@ public virtual Pageable GetPolicyDescriptions(Pol return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicyDescriptionContractData.DeserializePolicyDescriptionContractData, _policyDescriptionClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetPolicyDescriptions", "value", null, cancellationToken); } + /// + /// Validate all policies of API Management services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/validatePolicies + /// + /// + /// Operation Id + /// PolicyRestrictionValidations_ByService + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> ByServicePolicyRestrictionValidationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _policyRestrictionValidationsClientDiagnostics.CreateScope("ApiManagementServiceResource.ByServicePolicyRestrictionValidation"); + scope.Start(); + try + { + var response = await _policyRestrictionValidationsRestClient.ByServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new GitOperationResultContractDataOperationSource(), _policyRestrictionValidationsClientDiagnostics, Pipeline, _policyRestrictionValidationsRestClient.CreateByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validate all policies of API Management services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/validatePolicies + /// + /// + /// Operation Id + /// PolicyRestrictionValidations_ByService + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation ByServicePolicyRestrictionValidation(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _policyRestrictionValidationsClientDiagnostics.CreateScope("ApiManagementServiceResource.ByServicePolicyRestrictionValidation"); + scope.Start(); + try + { + var response = _policyRestrictionValidationsRestClient.ByService(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(new GitOperationResultContractDataOperationSource(), _policyRestrictionValidationsClientDiagnostics, Pipeline, _policyRestrictionValidationsRestClient.CreateByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Lists a collection of portalsettings defined within a service instance.. /// @@ -3117,9 +3635,9 @@ public virtual Pageable GetPortalSettings(Cancellati /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetProductsByTagsAsync(string filter = null, int? top = null, int? skip = null, bool? includeNotTaggedProducts = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetProductsByTags", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductProductRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductProductRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _serviceProductProductClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetProductsByTags", "value", "nextLink", cancellationToken); } /// @@ -3143,9 +3661,9 @@ public virtual AsyncPageable GetProductsByTagsAsync( /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetProductsByTags(string filter = null, int? top = null, int? skip = null, bool? includeNotTaggedProducts = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetProductsByTags", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductProductRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductProductRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _serviceProductProductClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetProductsByTags", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs index 22667373d91f..c892d9fcc9fb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs @@ -69,7 +69,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. - /// Create parameters. + /// Create parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -79,17 +79,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementSubscriptionSubscriptionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, content, notify, ifMatch, appType, cancellationToken).ConfigureAwait(false); + var response = await _apiManagementSubscriptionSubscriptionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, subscriptionCreateParameters, notify, ifMatch, appType, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementSubscriptionResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); @@ -117,7 +117,7 @@ public virtual async Task> Creat /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. - /// Create parameters. + /// Create parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -127,17 +127,17 @@ public virtual async Task> Creat /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementSubscriptionSubscriptionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, content, notify, ifMatch, appType, cancellationToken); + var response = _apiManagementSubscriptionSubscriptionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, subscriptionCreateParameters, notify, ifMatch, appType, cancellationToken); var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementSubscriptionResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs index c1e7a3d0d1d8..9b3ddd9e7cef 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs @@ -239,7 +239,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -247,16 +247,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionResource.Update"); scope.Start(); try { - var response = await _apiManagementSubscriptionSubscriptionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, notify, appType, cancellationToken).ConfigureAwait(false); + var response = await _apiManagementSubscriptionSubscriptionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, subscriptionUpdateParameters, notify, appType, cancellationToken).ConfigureAwait(false); return Response.FromValue(new ApiManagementSubscriptionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -280,7 +280,7 @@ public virtual async Task> UpdateAsy /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -288,16 +288,16 @@ public virtual async Task> UpdateAsy /// /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionResource.Update"); scope.Start(); try { - var response = _apiManagementSubscriptionSubscriptionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, notify, appType, cancellationToken); + var response = _apiManagementSubscriptionSubscriptionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, subscriptionUpdateParameters, notify, appType, cancellationToken); return Response.FromValue(new ApiManagementSubscriptionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs index 9c6c46b95cca..72b9aa1900e4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs @@ -91,6 +91,165 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } + /// Gets a collection of ServiceTagApiLinkResources in the ApiManagementTag. + /// An object representing collection of ServiceTagApiLinkResources and their operations over a ServiceTagApiLinkResource. + public virtual ServiceTagApiLinkCollection GetServiceTagApiLinks() + { + return GetCachedClient(client => new ServiceTagApiLinkCollection(client, Id)); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceTagApiLinkAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceTagApiLinks().GetAsync(apiLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceTagApiLink(string apiLinkId, CancellationToken cancellationToken = default) + { + return GetServiceTagApiLinks().Get(apiLinkId, cancellationToken); + } + + /// Gets a collection of ServiceTagOperationLinkResources in the ApiManagementTag. + /// An object representing collection of ServiceTagOperationLinkResources and their operations over a ServiceTagOperationLinkResource. + public virtual ServiceTagOperationLinkCollection GetServiceTagOperationLinks() + { + return GetCachedClient(client => new ServiceTagOperationLinkCollection(client, Id)); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceTagOperationLinkAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceTagOperationLinks().GetAsync(operationLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceTagOperationLink(string operationLinkId, CancellationToken cancellationToken = default) + { + return GetServiceTagOperationLinks().Get(operationLinkId, cancellationToken); + } + + /// Gets a collection of ServiceTagProductLinkResources in the ApiManagementTag. + /// An object representing collection of ServiceTagProductLinkResources and their operations over a ServiceTagProductLinkResource. + public virtual ServiceTagProductLinkCollection GetServiceTagProductLinks() + { + return GetCachedClient(client => new ServiceTagProductLinkCollection(client, Id)); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceTagProductLinkAsync(string productLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceTagProductLinks().GetAsync(productLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceTagProductLink(string productLinkId, CancellationToken cancellationToken = default) + { + return GetServiceTagProductLinks().Get(productLinkId, cancellationToken); + } + /// /// Gets the details of the tag specified by its identifier. /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs index 65e015759e79..ccf08e1016fe 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs @@ -247,7 +247,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if try { var response = await _apiManagementUserUserRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, notify, appType, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(response); + var operation = new ApiManagementArmOperation(_apiManagementUserUserClientDiagnostics, Pipeline, _apiManagementUserUserRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, notify, appType).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -285,7 +285,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? dele try { var response = _apiManagementUserUserRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, notify, appType, cancellationToken); - var operation = new ApiManagementArmOperation(response); + var operation = new ApiManagementArmOperation(_apiManagementUserUserClientDiagnostics, Pipeline, _apiManagementUserUserRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, notify, appType).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -512,12 +512,12 @@ public virtual Response GetSharedAccessToken(UserTokenContent c /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUserGroupsAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUserGroupsAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _userGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementGroupData.DeserializeApiManagementGroupData, _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); } /// @@ -537,12 +537,12 @@ public virtual AsyncPageable GetUserGroupsAsync(stri /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUserGroups(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUserGroups(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _userGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementGroupData.DeserializeApiManagementGroupData, _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs index 16f473ad5734..4240293dbab0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs @@ -22,8 +22,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiOperationPolicies method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiOperationPolicies method from an instance of . /// public partial class ApiOperationPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -50,8 +50,8 @@ internal ApiOperationPolicyCollection(ArmClient client, ResourceIdentifier id) : internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiOperationResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiOperationResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiOperationResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiOperationResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs index a0de3cc807e3..de0eecdfa9e9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiOperationPolicy along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiOperationPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetApiOperationPolicy method. + /// Otherwise you can get one from its parent resource using the GetApiOperationPolicy method. /// public partial class ApiOperationPolicyResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs index 3597959c4d6a..276a443ee697 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs @@ -21,8 +21,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiOperationTags method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiOperationTags method from an instance of . /// public partial class ApiOperationTagCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -49,8 +49,8 @@ internal ApiOperationTagCollection(ArmClient client, ResourceIdentifier id) : ba internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiOperationResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiOperationResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiOperationResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiOperationResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs index 5b72516fa4d3..38d0fdaa8ccf 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiOperationTag along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiOperationTagResource method. - /// Otherwise you can get one from its parent resource using the GetApiOperationTag method. + /// Otherwise you can get one from its parent resource using the GetApiOperationTag method. /// public partial class ApiOperationTagResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs index 1a5932af2ed9..891e925f55f5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs @@ -22,8 +22,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiPolicies method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiPolicies method from an instance of . /// public partial class ApiPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -50,8 +50,8 @@ internal ApiPolicyCollection(ArmClient client, ResourceIdentifier id) : base(cli internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs index 444831004eb8..55ba3af369f0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiPolicy along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetApiPolicy method. + /// Otherwise you can get one from its parent resource using the GetApiPolicy method. /// public partial class ApiPolicyResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaData.cs index 5ca9f6b3e647..45b384111e94 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaData.cs @@ -27,20 +27,24 @@ public ApiSchemaData() /// The name. /// The resourceType. /// The systemData. - /// Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. + /// Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml` </br> - `OData Schema` use `application/vnd.ms-azure-apim.odata.schema` </br> - `gRPC Schema` use `text/protobuf`. + /// The provisioning state. /// Json escaped string defining the document representing the Schema. Used for schemas other than Swagger/OpenAPI. /// Types definitions. Used for Swagger/OpenAPI v1 schemas only, null otherwise. /// Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only, null otherwise. - internal ApiSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string contentType, string value, BinaryData definitions, BinaryData components) : base(id, name, resourceType, systemData) + internal ApiSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string contentType, string provisioningState, string value, BinaryData definitions, BinaryData components) : base(id, name, resourceType, systemData) { ContentType = contentType; + ProvisioningState = provisioningState; Value = value; Definitions = definitions; Components = components; } - /// Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. + /// Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml` </br> - `OData Schema` use `application/vnd.ms-azure-apim.odata.schema` </br> - `gRPC Schema` use `text/protobuf`. public string ContentType { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } /// Json escaped string defining the document representing the Schema. Used for schemas other than Swagger/OpenAPI. public string Value { get; set; } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs index c3b8fa239698..c7dbeae0a961 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs @@ -21,8 +21,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiTags method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiTags method from an instance of . /// public partial class ApiTagCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -49,8 +49,8 @@ internal ApiTagCollection(ArmClient client, ResourceIdentifier id) : base(client internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs index 912d9eb5fd8f..c47cdd363b65 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs @@ -22,8 +22,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiTagDescriptions method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiTagDescriptions method from an instance of . /// public partial class ApiTagDescriptionCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -50,8 +50,8 @@ internal ApiTagDescriptionCollection(ArmClient client, ResourceIdentifier id) : internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs index 8d786eb2a51a..5e2af17c946d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiTagDescription along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiTagDescriptionResource method. - /// Otherwise you can get one from its parent resource using the GetApiTagDescription method. + /// Otherwise you can get one from its parent resource using the GetApiTagDescription method. /// public partial class ApiTagDescriptionResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs index ce6f7b399613..f81c6b7156ad 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiTag along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiTagResource method. - /// Otherwise you can get one from its parent resource using the GetApiTag method. + /// Otherwise you can get one from its parent resource using the GetApiTag method. /// public partial class ApiTagResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ArmApiManagementModelFactory.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ArmApiManagementModelFactory.cs index fdea0a31804d..dd5d0df9cf7d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ArmApiManagementModelFactory.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ArmApiManagementModelFactory.cs @@ -13,12 +13,26 @@ using Azure.Core; using Azure.ResourceManager.ApiManagement; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ApiManagement.Models { /// Model factory for models. public static partial class ArmApiManagementModelFactory { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Policy Identifier. + /// Policy Restriction Compliance State. + /// A new instance for mocking. + public static AllPoliciesContract AllPoliciesContract(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string referencePolicyId = null, PolicyComplianceState? complianceState = null) + { + return new AllPoliciesContract(id, name, resourceType, systemData, referencePolicyId, complianceState); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -45,12 +59,13 @@ public static partial class ArmApiManagementModelFactory /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. + /// The provisioning state. /// A new instance for mocking. - public static ApiData ApiData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, AuthenticationSettingsContract authenticationSettings = null, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames = null, ApiType? apiType = null, string apiRevision = null, string apiVersion = null, bool? isCurrent = null, bool? isOnline = null, string apiRevisionDescription = null, string apiVersionDescription = null, ResourceIdentifier apiVersionSetId = null, bool? isSubscriptionRequired = null, Uri termsOfServiceUri = null, ApiContactInformation contact = null, ApiLicenseInformation license = null, ResourceIdentifier sourceApiId = null, string displayName = null, Uri serviceUri = null, string path = null, IEnumerable protocols = null, ApiVersionSetContractDetails apiVersionSet = null) + public static ApiData ApiData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, AuthenticationSettingsContract authenticationSettings = null, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames = null, ApiType? apiType = null, string apiRevision = null, string apiVersion = null, bool? isCurrent = null, bool? isOnline = null, string apiRevisionDescription = null, string apiVersionDescription = null, ResourceIdentifier apiVersionSetId = null, bool? isSubscriptionRequired = null, Uri termsOfServiceUri = null, ApiContactInformation contact = null, ApiLicenseInformation license = null, ResourceIdentifier sourceApiId = null, string displayName = null, Uri serviceUri = null, string path = null, IEnumerable protocols = null, ApiVersionSetContractDetails apiVersionSet = null, string provisioningState = null) { protocols ??= new List(); - return new ApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet); + return new ApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet, provisioningState); } /// Initializes a new instance of . @@ -152,6 +167,20 @@ public static TagContractData TagContractData(ResourceIdentifier id = null, stri return new TagContractData(id, name, resourceType, systemData, displayName); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resolver Name. + /// Path is type/field being resolved. + /// Description of the resolver. May include HTML formatting tags. + /// A new instance for mocking. + public static ResolverContractData ResolverContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string path = null, string description = null) + { + return new ResolverContractData(id, name, resourceType, systemData, displayName, path, description); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -188,14 +217,15 @@ public static ProductEntityBaseProperties ProductEntityBaseProperties(string des /// The name. /// The resourceType. /// The systemData. - /// Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. + /// Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml` </br> - `OData Schema` use `application/vnd.ms-azure-apim.odata.schema` </br> - `gRPC Schema` use `text/protobuf`. + /// The provisioning state. /// Json escaped string defining the document representing the Schema. Used for schemas other than Swagger/OpenAPI. /// Types definitions. Used for Swagger/OpenAPI v1 schemas only, null otherwise. /// Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only, null otherwise. /// A new instance for mocking. - public static ApiSchemaData ApiSchemaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string contentType = null, string value = null, BinaryData definitions = null, BinaryData components = null) + public static ApiSchemaData ApiSchemaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string contentType = null, string provisioningState = null, string value = null, BinaryData definitions = null, BinaryData components = null) { - return new ApiSchemaData(id, name, resourceType, systemData, contentType, value, definitions, components); + return new ApiSchemaData(id, name, resourceType, systemData, contentType, provisioningState, value, definitions, components); } /// Initializes a new instance of . @@ -359,6 +389,20 @@ public static AssociatedProductProperties AssociatedProductProperties(string des return new AssociatedProductProperties(description, terms, isSubscriptionRequired, isApprovalRequired, subscriptionsLimit, state, id, name); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Collection wiki documents included into this wiki. + /// A new instance for mocking. + public static WikiContractData WikiContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable documents = null) + { + documents ??= new List(); + + return new WikiContractData(id, name, resourceType, systemData, documents?.ToList()); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -375,6 +419,62 @@ public static ApiVersionSetData ApiVersionSetData(ResourceIdentifier id = null, return new ApiVersionSetData(id, name, resourceType, systemData, description, versionQueryName, versionHeaderName, displayName, versioningScheme); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Authorization Provider name. Must be 1 to 300 characters long. + /// Identity provider name. Must be 1 to 300 characters long. + /// OAuth2 settings. + /// A new instance for mocking. + public static AuthorizationProviderContractData AuthorizationProviderContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string identityProvider = null, AuthorizationProviderOAuth2Settings oauth2 = null) + { + return new AuthorizationProviderContractData(id, name, resourceType, systemData, displayName, identityProvider, oauth2); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Authorization type options. + /// OAuth2 grant type options. + /// Authorization parameters. + /// Authorization error details. + /// Status of the Authorization. + /// A new instance for mocking. + public static AuthorizationContractData AuthorizationContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AuthorizationType? authorizationType = null, OAuth2GrantType? oAuth2GrantType = null, IDictionary parameters = null, AuthorizationError error = null, string status = null) + { + parameters ??= new Dictionary(); + + return new AuthorizationContractData(id, name, resourceType, systemData, authorizationType, oAuth2GrantType, parameters, error, status); + } + + /// Initializes a new instance of . + /// The login link. + /// A new instance for mocking. + public static AuthorizationLoginResponseContract AuthorizationLoginResponseContract(string loginLink = null) + { + return new AuthorizationLoginResponseContract(loginLink); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The allowed Azure Active Directory Application IDs. + /// The Tenant Id. + /// The Object Id. + /// A new instance for mocking. + public static AuthorizationAccessPolicyContractData AuthorizationAccessPolicyContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable appIds = null, Guid? tenantId = null, string objectId = null) + { + appIds ??= new List(); + + return new AuthorizationAccessPolicyContractData(id, name, resourceType, systemData, appIds?.ToList(), tenantId, objectId); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -391,13 +491,15 @@ public static ApiVersionSetData ApiVersionSetData(ResourceIdentifier id = null, /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. /// User-friendly authorization server name. + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. /// Form of an authorization grant, which the client uses to request the access token. /// Client or app id registered with this authorization server. /// Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// A new instance for mocking. - public static ApiManagementAuthorizationServerData ApiManagementAuthorizationServerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, IEnumerable authorizationMethods = null, IEnumerable clientAuthenticationMethods = null, IEnumerable tokenBodyParameters = null, string tokenEndpoint = null, bool? doesSupportState = null, string defaultScope = null, IEnumerable bearerTokenSendingMethods = null, string resourceOwnerUsername = null, string resourceOwnerPassword = null, string displayName = null, string clientRegistrationEndpoint = null, string authorizationEndpoint = null, IEnumerable grantTypes = null, string clientId = null, string clientSecret = null) + public static ApiManagementAuthorizationServerData ApiManagementAuthorizationServerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, IEnumerable authorizationMethods = null, IEnumerable clientAuthenticationMethods = null, IEnumerable tokenBodyParameters = null, string tokenEndpoint = null, bool? doesSupportState = null, string defaultScope = null, IEnumerable bearerTokenSendingMethods = null, string resourceOwnerUsername = null, string resourceOwnerPassword = null, string displayName = null, bool? useInTestConsole = null, bool? useInApiDocumentation = null, string clientRegistrationEndpoint = null, string authorizationEndpoint = null, IEnumerable grantTypes = null, string clientId = null, string clientSecret = null) { authorizationMethods ??= new List(); clientAuthenticationMethods ??= new List(); @@ -405,7 +507,7 @@ public static ApiManagementAuthorizationServerData ApiManagementAuthorizationSer bearerTokenSendingMethods ??= new List(); grantTypes ??= new List(); - return new ApiManagementAuthorizationServerData(id, name, resourceType, systemData, description, authorizationMethods?.ToList(), clientAuthenticationMethods?.ToList(), tokenBodyParameters?.ToList(), tokenEndpoint, doesSupportState, defaultScope, bearerTokenSendingMethods?.ToList(), resourceOwnerUsername, resourceOwnerPassword, displayName, clientRegistrationEndpoint, authorizationEndpoint, grantTypes?.ToList(), clientId, clientSecret); + return new ApiManagementAuthorizationServerData(id, name, resourceType, systemData, description, authorizationMethods?.ToList(), clientAuthenticationMethods?.ToList(), tokenBodyParameters?.ToList(), tokenEndpoint, doesSupportState, defaultScope, bearerTokenSendingMethods?.ToList(), resourceOwnerUsername, resourceOwnerPassword, displayName, useInTestConsole, useInApiDocumentation, clientRegistrationEndpoint, authorizationEndpoint, grantTypes?.ToList(), clientId, clientSecret); } /// Initializes a new instance of . @@ -424,13 +526,15 @@ public static ApiManagementAuthorizationServerData ApiManagementAuthorizationSer /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. /// User-friendly authorization server name. + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. /// Form of an authorization grant, which the client uses to request the access token. /// Client or app id registered with this authorization server. /// Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// A new instance for mocking. - public static ApiManagementAuthorizationServerPatch ApiManagementAuthorizationServerPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, IEnumerable authorizationMethods = null, IEnumerable clientAuthenticationMethods = null, IEnumerable tokenBodyParameters = null, string tokenEndpoint = null, bool? doesSupportState = null, string defaultScope = null, IEnumerable bearerTokenSendingMethods = null, string resourceOwnerUsername = null, string resourceOwnerPassword = null, string displayName = null, string clientRegistrationEndpoint = null, string authorizationEndpoint = null, IEnumerable grantTypes = null, string clientId = null, string clientSecret = null) + public static ApiManagementAuthorizationServerPatch ApiManagementAuthorizationServerPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, IEnumerable authorizationMethods = null, IEnumerable clientAuthenticationMethods = null, IEnumerable tokenBodyParameters = null, string tokenEndpoint = null, bool? doesSupportState = null, string defaultScope = null, IEnumerable bearerTokenSendingMethods = null, string resourceOwnerUsername = null, string resourceOwnerPassword = null, string displayName = null, bool? useInTestConsole = null, bool? useInApiDocumentation = null, string clientRegistrationEndpoint = null, string authorizationEndpoint = null, IEnumerable grantTypes = null, string clientId = null, string clientSecret = null) { authorizationMethods ??= new List(); clientAuthenticationMethods ??= new List(); @@ -438,7 +542,7 @@ public static ApiManagementAuthorizationServerPatch ApiManagementAuthorizationSe bearerTokenSendingMethods ??= new List(); grantTypes ??= new List(); - return new ApiManagementAuthorizationServerPatch(id, name, resourceType, systemData, description, authorizationMethods?.ToList(), clientAuthenticationMethods?.ToList(), tokenBodyParameters?.ToList(), tokenEndpoint, doesSupportState, defaultScope, bearerTokenSendingMethods?.ToList(), resourceOwnerUsername, resourceOwnerPassword, displayName, clientRegistrationEndpoint, authorizationEndpoint, grantTypes?.ToList(), clientId, clientSecret); + return new ApiManagementAuthorizationServerPatch(id, name, resourceType, systemData, description, authorizationMethods?.ToList(), clientAuthenticationMethods?.ToList(), tokenBodyParameters?.ToList(), tokenEndpoint, doesSupportState, defaultScope, bearerTokenSendingMethods?.ToList(), resourceOwnerUsername, resourceOwnerPassword, displayName, useInTestConsole, useInApiDocumentation, clientRegistrationEndpoint, authorizationEndpoint, grantTypes?.ToList(), clientId, clientSecret); } /// Initializes a new instance of . @@ -458,17 +562,23 @@ public static AuthorizationServerSecretsContract AuthorizationServerSecretsContr /// The systemData. /// Backend Title. /// Backend Description. - /// Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. + /// Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. /// Backend Properties contract. /// Backend Credentials Contract Properties. - /// Backend Proxy Contract Properties. + /// Backend gateway Contract Properties. /// Backend TLS Properties. + /// Backend Circuit Breaker Configuration. + /// + /// Type of the backend. A backend can be either Single or Pool. /// Runtime Url of the Backend. /// Backend communication protocol. /// A new instance for mocking. - public static ApiManagementBackendData ApiManagementBackendData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string title = null, string description = null, Uri resourceUri = null, BackendServiceFabricClusterProperties backendServiceFabricCluster = null, BackendCredentialsContract credentials = null, BackendProxyContract proxy = null, BackendTlsProperties tls = null, Uri uri = null, BackendProtocol? protocol = null) + public static ApiManagementBackendData ApiManagementBackendData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string title = null, string description = null, Uri resourceUri = null, BackendServiceFabricClusterProperties backendServiceFabricCluster = null, BackendCredentialsContract credentials = null, BackendProxyContract proxy = null, BackendTlsProperties tls = null, IEnumerable circuitBreakerRules = null, IEnumerable poolServices = null, BackendType? typePropertiesType = null, Uri uri = null, BackendProtocol? protocol = null) { - return new ApiManagementBackendData(id, name, resourceType, systemData, title, description, resourceUri, backendServiceFabricCluster != null ? new BackendProperties(backendServiceFabricCluster) : null, credentials, proxy, tls, uri, protocol); + circuitBreakerRules ??= new List(); + poolServices ??= new List(); + + return new ApiManagementBackendData(id, name, resourceType, systemData, title, description, resourceUri, backendServiceFabricCluster != null ? new BackendProperties(backendServiceFabricCluster) : null, credentials, proxy, tls, circuitBreakerRules != null ? new BackendCircuitBreaker(circuitBreakerRules?.ToList()) : null, poolServices != null ? new BackendBaseParametersPool(poolServices?.ToList()) : null, typePropertiesType, uri, protocol); } /// Initializes a new instance of . @@ -623,21 +733,26 @@ public static ApiManagementResourceSkuCapacity ApiManagementResourceSkuCapacity( /// Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. /// Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network. /// Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + /// Configuration API configuration of the API Management service. /// Virtual network configuration of the API Management service. /// Additional datacenter locations of the API Management service. - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + /// Property can be used to enable NAT Gateway for this API Management service. + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. /// Control Plane Apis version constraint for the API Management service. /// Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. /// List of Private Endpoint Connections of this service. /// Compute Platform Version running the service in this location. + /// Status of legacy portal in the API Management service. + /// Status of developer portal in this API Management service. /// Publisher email. /// Publisher name. /// A new instance for mocking. - public static ApiManagementServiceData ApiManagementServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ApiManagementServiceSkuProperties sku = null, ManagedServiceIdentity identity = null, ETag? etag = null, IEnumerable zones = null, string notificationSenderEmail = null, string provisioningState = null, string targetProvisioningState = null, DateTimeOffset? createdAtUtc = null, Uri gatewayUri = null, Uri gatewayRegionalUri = null, Uri portalUri = null, Uri managementApiUri = null, Uri scmUri = null, Uri developerPortalUri = null, IEnumerable hostnameConfigurations = null, IEnumerable publicIPAddresses = null, IEnumerable privateIPAddresses = null, ResourceIdentifier publicIPAddressId = null, PublicNetworkAccess? publicNetworkAccess = null, VirtualNetworkConfiguration virtualNetworkConfiguration = null, IEnumerable additionalLocations = null, IDictionary customProperties = null, IEnumerable certificates = null, bool? enableClientCertificate = null, bool? disableGateway = null, VirtualNetworkType? virtualNetworkType = null, string minApiVersion = null, bool? restore = null, IEnumerable privateEndpointConnections = null, PlatformVersion? platformVersion = null, string publisherEmail = null, string publisherName = null) + public static ApiManagementServiceData ApiManagementServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ApiManagementServiceSkuProperties sku = null, ManagedServiceIdentity identity = null, ETag? etag = null, IEnumerable zones = null, string notificationSenderEmail = null, string provisioningState = null, string targetProvisioningState = null, DateTimeOffset? createdAtUtc = null, Uri gatewayUri = null, Uri gatewayRegionalUri = null, Uri portalUri = null, Uri managementApiUri = null, Uri scmUri = null, Uri developerPortalUri = null, IEnumerable hostnameConfigurations = null, IEnumerable publicIPAddresses = null, IEnumerable privateIPAddresses = null, ResourceIdentifier publicIPAddressId = null, PublicNetworkAccess? publicNetworkAccess = null, LegacyApiState? legacyApi = null, VirtualNetworkConfiguration virtualNetworkConfiguration = null, IEnumerable additionalLocations = null, IDictionary customProperties = null, IEnumerable certificates = null, bool? enableClientCertificate = null, NatGatewayState? natGatewayState = null, IEnumerable outboundPublicIPAddresses = null, bool? disableGateway = null, VirtualNetworkType? virtualNetworkType = null, string minApiVersion = null, bool? restore = null, IEnumerable privateEndpointConnections = null, PlatformVersion? platformVersion = null, LegacyPortalStatus? legacyPortalStatus = null, DeveloperPortalStatus? developerPortalStatus = null, string publisherEmail = null, string publisherName = null) { tags ??= new Dictionary(); zones ??= new List(); @@ -647,9 +762,10 @@ public static ApiManagementServiceData ApiManagementServiceData(ResourceIdentifi additionalLocations ??= new List(); customProperties ??= new Dictionary(); certificates ??= new List(); + outboundPublicIPAddresses ??= new List(); privateEndpointConnections ??= new List(); - return new ApiManagementServiceData(id, name, resourceType, systemData, tags, location, sku, identity, etag, zones?.ToList(), notificationSenderEmail, provisioningState, targetProvisioningState, createdAtUtc, gatewayUri, gatewayRegionalUri, portalUri, managementApiUri, scmUri, developerPortalUri, hostnameConfigurations?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, publicNetworkAccess, virtualNetworkConfiguration, additionalLocations?.ToList(), customProperties, certificates?.ToList(), enableClientCertificate, disableGateway, virtualNetworkType, minApiVersion != null ? new ApiVersionConstraint(minApiVersion) : null, restore, privateEndpointConnections?.ToList(), platformVersion, publisherEmail, publisherName); + return new ApiManagementServiceData(id, name, resourceType, systemData, tags, location, sku, identity, etag, zones?.ToList(), notificationSenderEmail, provisioningState, targetProvisioningState, createdAtUtc, gatewayUri, gatewayRegionalUri, portalUri, managementApiUri, scmUri, developerPortalUri, hostnameConfigurations?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, publicNetworkAccess, legacyApi != null ? new ConfigurationApi(legacyApi) : null, virtualNetworkConfiguration, additionalLocations?.ToList(), customProperties, certificates?.ToList(), enableClientCertificate, natGatewayState, outboundPublicIPAddresses?.ToList(), disableGateway, virtualNetworkType, minApiVersion != null ? new ApiVersionConstraint(minApiVersion) : null, restore, privateEndpointConnections?.ToList(), platformVersion, legacyPortalStatus, developerPortalStatus, publisherEmail, publisherName); } /// Initializes a new instance of . @@ -671,16 +787,19 @@ public static VirtualNetworkConfiguration VirtualNetworkConfiguration(Guid? vnet /// Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the location. Supported only for Premium SKU being deployed in Virtual Network. /// Virtual network configuration for the location. /// Gateway URL of the API Management service in the Region. + /// Property can be used to enable NAT Gateway for this API Management service. + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. /// Compute Platform Version running the service. /// A new instance for mocking. - public static AdditionalLocation AdditionalLocation(AzureLocation location = default, ApiManagementServiceSkuProperties sku = null, IEnumerable zones = null, IEnumerable publicIPAddresses = null, IEnumerable privateIPAddresses = null, ResourceIdentifier publicIPAddressId = null, VirtualNetworkConfiguration virtualNetworkConfiguration = null, Uri gatewayRegionalUri = null, bool? disableGateway = null, PlatformVersion? platformVersion = null) + public static AdditionalLocation AdditionalLocation(AzureLocation location = default, ApiManagementServiceSkuProperties sku = null, IEnumerable zones = null, IEnumerable publicIPAddresses = null, IEnumerable privateIPAddresses = null, ResourceIdentifier publicIPAddressId = null, VirtualNetworkConfiguration virtualNetworkConfiguration = null, Uri gatewayRegionalUri = null, NatGatewayState? natGatewayState = null, IEnumerable outboundPublicIPAddresses = null, bool? disableGateway = null, PlatformVersion? platformVersion = null) { zones ??= new List(); publicIPAddresses ??= new List(); privateIPAddresses ??= new List(); + outboundPublicIPAddresses ??= new List(); - return new AdditionalLocation(location, sku, zones?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, virtualNetworkConfiguration, gatewayRegionalUri, disableGateway, platformVersion); + return new AdditionalLocation(location, sku, zones?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, virtualNetworkConfiguration, gatewayRegionalUri, natGatewayState, outboundPublicIPAddresses?.ToList(), disableGateway, platformVersion); } /// Initializes a new instance of . @@ -723,22 +842,27 @@ public static RemotePrivateEndpointConnectionWrapper RemotePrivateEndpointConnec /// Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. /// Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network. /// Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + /// Configuration API configuration of the API Management service. /// Virtual network configuration of the API Management service. /// Additional datacenter locations of the API Management service. - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + /// Property can be used to enable NAT Gateway for this API Management service. + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. /// Control Plane Apis version constraint for the API Management service. /// Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. /// List of Private Endpoint Connections of this service. /// Compute Platform Version running the service in this location. + /// Status of legacy portal in the API Management service. + /// Status of developer portal in this API Management service. /// Publisher email. /// Publisher name. /// Resource tags. /// A new instance for mocking. - public static ApiManagementServicePatch ApiManagementServicePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ApiManagementServiceSkuProperties sku = null, ManagedServiceIdentity identity = null, ETag? etag = null, IEnumerable zones = null, string notificationSenderEmail = null, string provisioningState = null, string targetProvisioningState = null, DateTimeOffset? createdAtUtc = null, Uri gatewayUri = null, Uri gatewayRegionalUri = null, Uri portalUri = null, Uri managementApiUri = null, Uri scmUri = null, Uri developerPortalUri = null, IEnumerable hostnameConfigurations = null, IEnumerable publicIPAddresses = null, IEnumerable privateIPAddresses = null, ResourceIdentifier publicIPAddressId = null, PublicNetworkAccess? publicNetworkAccess = null, VirtualNetworkConfiguration virtualNetworkConfiguration = null, IEnumerable additionalLocations = null, IDictionary customProperties = null, IEnumerable certificates = null, bool? enableClientCertificate = null, bool? disableGateway = null, VirtualNetworkType? virtualNetworkType = null, string minApiVersion = null, bool? restore = null, IEnumerable privateEndpointConnections = null, PlatformVersion? platformVersion = null, string publisherEmail = null, string publisherName = null, IDictionary tags = null) + public static ApiManagementServicePatch ApiManagementServicePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ApiManagementServiceSkuProperties sku = null, ManagedServiceIdentity identity = null, ETag? etag = null, IEnumerable zones = null, string notificationSenderEmail = null, string provisioningState = null, string targetProvisioningState = null, DateTimeOffset? createdAtUtc = null, Uri gatewayUri = null, Uri gatewayRegionalUri = null, Uri portalUri = null, Uri managementApiUri = null, Uri scmUri = null, Uri developerPortalUri = null, IEnumerable hostnameConfigurations = null, IEnumerable publicIPAddresses = null, IEnumerable privateIPAddresses = null, ResourceIdentifier publicIPAddressId = null, PublicNetworkAccess? publicNetworkAccess = null, LegacyApiState? legacyApi = null, VirtualNetworkConfiguration virtualNetworkConfiguration = null, IEnumerable additionalLocations = null, IDictionary customProperties = null, IEnumerable certificates = null, bool? enableClientCertificate = null, NatGatewayState? natGatewayState = null, IEnumerable outboundPublicIPAddresses = null, bool? disableGateway = null, VirtualNetworkType? virtualNetworkType = null, string minApiVersion = null, bool? restore = null, IEnumerable privateEndpointConnections = null, PlatformVersion? platformVersion = null, LegacyPortalStatus? legacyPortalStatus = null, DeveloperPortalStatus? developerPortalStatus = null, string publisherEmail = null, string publisherName = null, IDictionary tags = null) { zones ??= new List(); hostnameConfigurations ??= new List(); @@ -747,10 +871,11 @@ public static ApiManagementServicePatch ApiManagementServicePatch(ResourceIdenti additionalLocations ??= new List(); customProperties ??= new Dictionary(); certificates ??= new List(); + outboundPublicIPAddresses ??= new List(); privateEndpointConnections ??= new List(); tags ??= new Dictionary(); - return new ApiManagementServicePatch(id, name, resourceType, systemData, sku, identity, etag, zones?.ToList(), notificationSenderEmail, provisioningState, targetProvisioningState, createdAtUtc, gatewayUri, gatewayRegionalUri, portalUri, managementApiUri, scmUri, developerPortalUri, hostnameConfigurations?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, publicNetworkAccess, virtualNetworkConfiguration, additionalLocations?.ToList(), customProperties, certificates?.ToList(), enableClientCertificate, disableGateway, virtualNetworkType, minApiVersion != null ? new ApiVersionConstraint(minApiVersion) : null, restore, privateEndpointConnections?.ToList(), platformVersion, publisherEmail, publisherName, tags); + return new ApiManagementServicePatch(id, name, resourceType, systemData, sku, identity, etag, zones?.ToList(), notificationSenderEmail, provisioningState, targetProvisioningState, createdAtUtc, gatewayUri, gatewayRegionalUri, portalUri, managementApiUri, scmUri, developerPortalUri, hostnameConfigurations?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, publicNetworkAccess, legacyApi != null ? new ConfigurationApi(legacyApi) : null, virtualNetworkConfiguration, additionalLocations?.ToList(), customProperties, certificates?.ToList(), enableClientCertificate, natGatewayState, outboundPublicIPAddresses?.ToList(), disableGateway, virtualNetworkType, minApiVersion != null ? new ApiVersionConstraint(minApiVersion) : null, restore, privateEndpointConnections?.ToList(), platformVersion, legacyPortalStatus, developerPortalStatus, publisherEmail, publisherName, tags); } /// Initializes a new instance of . @@ -779,6 +904,19 @@ public static ApiManagementServiceGetDomainOwnershipIdentifierResult ApiManageme return new ApiManagementServiceGetDomainOwnershipIdentifierResult(domainOwnershipIdentifier); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// documentation title. + /// Markdown documentation content. + /// A new instance for mocking. + public static DocumentationContractData DocumentationContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string title = null, string content = null) + { + return new DocumentationContractData(id, name, resourceType, systemData, title, content); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -871,12 +1009,13 @@ public static ApiManagementGatewayHostnameConfigurationData ApiManagementGateway /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. + /// The provisioning state. /// A new instance for mocking. - public static GatewayApiData GatewayApiData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, AuthenticationSettingsContract authenticationSettings = null, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames = null, ApiType? apiType = null, string apiRevision = null, string apiVersion = null, bool? isCurrent = null, bool? isOnline = null, string apiRevisionDescription = null, string apiVersionDescription = null, ResourceIdentifier apiVersionSetId = null, bool? isSubscriptionRequired = null, Uri termsOfServiceUri = null, ApiContactInformation contact = null, ApiLicenseInformation license = null, ResourceIdentifier sourceApiId = null, string displayName = null, Uri serviceUri = null, string path = null, IEnumerable protocols = null, ApiVersionSetContractDetails apiVersionSet = null) + public static GatewayApiData GatewayApiData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, AuthenticationSettingsContract authenticationSettings = null, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames = null, ApiType? apiType = null, string apiRevision = null, string apiVersion = null, bool? isCurrent = null, bool? isOnline = null, string apiRevisionDescription = null, string apiVersionDescription = null, ResourceIdentifier apiVersionSetId = null, bool? isSubscriptionRequired = null, Uri termsOfServiceUri = null, ApiContactInformation contact = null, ApiLicenseInformation license = null, ResourceIdentifier sourceApiId = null, string displayName = null, Uri serviceUri = null, string path = null, IEnumerable protocols = null, ApiVersionSetContractDetails apiVersionSet = null, string provisioningState = null) { protocols ??= new List(); - return new GatewayApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet); + return new GatewayApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet, provisioningState); } /// Initializes a new instance of . @@ -903,6 +1042,14 @@ public static ApiManagementGatewayCertificateAuthorityData ApiManagementGatewayC return new ApiManagementGatewayCertificateAuthorityData(id, name, resourceType, systemData, isTrusted); } + /// Initializes a new instance of . + /// Gateway debug token. + /// A new instance for mocking. + public static GatewayDebugCredentialsContract GatewayDebugCredentialsContract(string token = null) + { + return new GatewayDebugCredentialsContract(token); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -994,14 +1141,15 @@ public static UserContractData UserContractData(ResourceIdentifier id = null, st /// Signin Policy Name. Only applies to AAD B2C Identity Provider. /// Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// A new instance for mocking. - public static ApiManagementIdentityProviderData ApiManagementIdentityProviderData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IdentityProviderType? identityProviderType = null, string signInTenant = null, IEnumerable allowedTenants = null, string authority = null, string signUpPolicyName = null, string signInPolicyName = null, string profileEditingPolicyName = null, string passwordResetPolicyName = null, string clientId = null, string clientSecret = null) + public static ApiManagementIdentityProviderData ApiManagementIdentityProviderData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IdentityProviderType? identityProviderType = null, string signInTenant = null, IEnumerable allowedTenants = null, string authority = null, string signUpPolicyName = null, string signInPolicyName = null, string profileEditingPolicyName = null, string passwordResetPolicyName = null, string clientLibrary = null, string clientId = null, string clientSecret = null) { allowedTenants ??= new List(); - return new ApiManagementIdentityProviderData(id, name, resourceType, systemData, identityProviderType, signInTenant, allowedTenants?.ToList(), authority, signUpPolicyName, signInPolicyName, profileEditingPolicyName, passwordResetPolicyName, clientId, clientSecret); + return new ApiManagementIdentityProviderData(id, name, resourceType, systemData, identityProviderType, signInTenant, allowedTenants?.ToList(), authority, signUpPolicyName, signInPolicyName, profileEditingPolicyName, passwordResetPolicyName, clientLibrary, clientId, clientSecret); } /// Initializes a new instance of . @@ -1017,14 +1165,15 @@ public static ApiManagementIdentityProviderData ApiManagementIdentityProviderDat /// Signin Policy Name. Only applies to AAD B2C Identity Provider. /// Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// A new instance for mocking. - public static ApiManagementIdentityProviderCreateOrUpdateContent ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IdentityProviderType? identityProviderType = null, string signInTenant = null, IEnumerable allowedTenants = null, string authority = null, string signUpPolicyName = null, string signInPolicyName = null, string profileEditingPolicyName = null, string passwordResetPolicyName = null, string clientId = null, string clientSecret = null) + public static ApiManagementIdentityProviderCreateOrUpdateContent ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IdentityProviderType? identityProviderType = null, string signInTenant = null, IEnumerable allowedTenants = null, string authority = null, string signUpPolicyName = null, string signInPolicyName = null, string profileEditingPolicyName = null, string passwordResetPolicyName = null, string clientLibrary = null, string clientId = null, string clientSecret = null) { allowedTenants ??= new List(); - return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, resourceType, systemData, identityProviderType, signInTenant, allowedTenants?.ToList(), authority, signUpPolicyName, signInPolicyName, profileEditingPolicyName, passwordResetPolicyName, clientId, clientSecret); + return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, resourceType, systemData, identityProviderType, signInTenant, allowedTenants?.ToList(), authority, signUpPolicyName, signInPolicyName, profileEditingPolicyName, passwordResetPolicyName, clientLibrary, clientId, clientSecret); } /// Initializes a new instance of . @@ -1066,15 +1215,16 @@ public static ApiManagementLoggerData ApiManagementLoggerData(ResourceIdentifier /// Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. /// Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// KeyVault location details of the namedValue. + /// The provisioning state. /// A new instance for mocking. - public static ApiManagementNamedValueData ApiManagementNamedValueData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable tags = null, bool? isSecret = null, string displayName = null, string value = null, KeyVaultContractProperties keyVaultDetails = null) + public static ApiManagementNamedValueData ApiManagementNamedValueData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable tags = null, bool? isSecret = null, string displayName = null, string value = null, KeyVaultContractProperties keyVaultDetails = null, string provisioningState = null) { tags ??= new List(); - return new ApiManagementNamedValueData(id, name, resourceType, systemData, tags?.ToList(), isSecret, displayName, value, keyVaultDetails); + return new ApiManagementNamedValueData(id, name, resourceType, systemData, tags?.ToList(), isSecret, displayName, value, keyVaultDetails, provisioningState); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1084,12 +1234,12 @@ public static ApiManagementNamedValueData ApiManagementNamedValueData(ResourceId /// Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. /// Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// KeyVault location details of the namedValue. - /// A new instance for mocking. - public static ApiManagementNamedValueCreateOrUpdateContent ApiManagementNamedValueCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable tags = null, bool? isSecret = null, string displayName = null, string value = null, KeyVaultContractCreateProperties keyVault = null) + /// A new instance for mocking. + public static NamedValueCreateContract NamedValueCreateContract(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable tags = null, bool? isSecret = null, string displayName = null, string value = null, KeyVaultContractCreateProperties keyVault = null) { tags ??= new List(); - return new ApiManagementNamedValueCreateOrUpdateContent(id, name, resourceType, systemData, tags?.ToList(), isSecret, displayName, value, keyVault); + return new NamedValueCreateContract(id, name, resourceType, systemData, tags?.ToList(), isSecret, displayName, value, keyVault); } /// Initializes a new instance of . @@ -1189,10 +1339,12 @@ public static RecipientEmailContract RecipientEmailContract(ResourceIdentifier i /// Metadata endpoint URI. /// Client ID of developer console which is the client application. /// Client Secret of developer console which is the client application. + /// If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided. + /// If true, the Open ID Connect provider will be used in the API documentation in the developer portal. False by default if no value is provided. /// A new instance for mocking. - public static ApiManagementOpenIdConnectProviderData ApiManagementOpenIdConnectProviderData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string description = null, string metadataEndpoint = null, string clientId = null, string clientSecret = null) + public static ApiManagementOpenIdConnectProviderData ApiManagementOpenIdConnectProviderData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string description = null, string metadataEndpoint = null, string clientId = null, string clientSecret = null, bool? useInTestConsole = null, bool? useInApiDocumentation = null) { - return new ApiManagementOpenIdConnectProviderData(id, name, resourceType, systemData, displayName, description, metadataEndpoint, clientId, clientSecret); + return new ApiManagementOpenIdConnectProviderData(id, name, resourceType, systemData, displayName, description, metadataEndpoint, clientId, clientSecret, useInTestConsole, useInApiDocumentation); } /// Initializes a new instance of . @@ -1239,6 +1391,100 @@ public static PolicyDescriptionContractData PolicyDescriptionContractData(Resour return new PolicyDescriptionContractData(id, name, resourceType, systemData, description, scope); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Contents of the policy fragment. + /// Policy fragment description. + /// Format of the policy fragment content. + /// The provisioning state. + /// A new instance for mocking. + public static PolicyFragmentContractData PolicyFragmentContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string value = null, string description = null, PolicyFragmentContentFormat? format = null, string provisioningState = null) + { + return new PolicyFragmentContractData(id, name, resourceType, systemData, value, description, format, provisioningState); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// A new instance for mocking. + public static ResourceCollectionValueItem ResourceCollectionValueItem(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null) + { + return new ResourceCollectionValueItem(id, name, resourceType, systemData); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Path to the policy document. + /// Indicates if base policy should be enforced for the policy document. + /// A new instance for mocking. + public static PolicyRestrictionContractData PolicyRestrictionContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string scope = null, PolicyRestrictionRequireBase? requireBase = null) + { + return new PolicyRestrictionContractData(id, name, resourceType, systemData, scope, requireBase); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Operation result identifier. + /// Status of an async operation. + /// + /// Start time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + /// + /// + /// + /// Last update time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + /// + /// + /// Optional result info. + /// Error Body Contract. + /// This property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation. + /// A new instance for mocking. + public static GitOperationResultContractData GitOperationResultContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string operationResultIdentifier = null, AsyncOperationStatus? status = null, DateTimeOffset? startedOn = null, DateTimeOffset? updatedOn = null, string resultInfo = null, ErrorResponseBody error = null, IEnumerable actionLog = null) + { + actionLog ??= new List(); + + return new GitOperationResultContractData(id, name, resourceType, systemData, operationResultIdentifier, status, startedOn, updatedOn, resultInfo, error, actionLog?.ToList()); + } + + /// Initializes a new instance of . + /// The type of entity contract. + /// Action like create/update/delete. + /// Identifier of the entity being created/updated/deleted. + /// A new instance for mocking. + public static OperationResultLogItemContract OperationResultLogItemContract(string objectType = null, string action = null, string objectKey = null) + { + return new OperationResultLogItemContract(objectType, action, objectKey); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Enable or disable Basic authentication method. + /// + /// + /// The developer portal delegation settings. + /// The developer portal Cross-Origin Resource Sharing (CORS) settings. + /// The developer portal Content Security Policy (CSP) settings. + /// A new instance for mocking. + public static PortalConfigContractData PortalConfigContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? enableBasicAuth = null, bool? require = null, PortalConfigTermsOfServiceProperties signupTermsOfService = null, PortalConfigDelegationProperties delegation = null, IEnumerable corsAllowedOrigins = null, PortalConfigCspProperties csp = null) + { + corsAllowedOrigins ??= new List(); + + return new PortalConfigContractData(id, name, resourceType, systemData, enableBasicAuth, require != null ? new PortalConfigPropertiesSignin(require) : null, signupTermsOfService != null ? new PortalConfigPropertiesSignup(signupTermsOfService) : null, delegation, corsAllowedOrigins != null ? new PortalConfigCorsProperties(corsAllowedOrigins?.ToList()) : null, csp); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -1250,10 +1496,11 @@ public static PolicyDescriptionContractData PolicyDescriptionContractData(Resour /// Indicates if the portal's revision is public. /// Portal's revision creation date and time. /// Last updated date and time. + /// The provisioning state. /// A new instance for mocking. - public static ApiManagementPortalRevisionData ApiManagementPortalRevisionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string statusDetails = null, PortalRevisionStatus? status = null, bool? isCurrent = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null) + public static ApiManagementPortalRevisionData ApiManagementPortalRevisionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string statusDetails = null, PortalRevisionStatus? status = null, bool? isCurrent = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, string provisioningState = null) { - return new ApiManagementPortalRevisionData(id, name, resourceType, systemData, description, statusDetails, status, isCurrent, createdOn, updatedOn); + return new ApiManagementPortalRevisionData(id, name, resourceType, systemData, description, statusDetails, status, isCurrent, createdOn, updatedOn, provisioningState); } /// Initializes a new instance of . @@ -1378,12 +1625,13 @@ public static ApiManagementPrivateLinkResourceData ApiManagementPrivateLinkResou /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. + /// The provisioning state. /// A new instance for mocking. - public static ProductApiData ProductApiData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, AuthenticationSettingsContract authenticationSettings = null, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames = null, ApiType? apiType = null, string apiRevision = null, string apiVersion = null, bool? isCurrent = null, bool? isOnline = null, string apiRevisionDescription = null, string apiVersionDescription = null, ResourceIdentifier apiVersionSetId = null, bool? isSubscriptionRequired = null, Uri termsOfServiceUri = null, ApiContactInformation contact = null, ApiLicenseInformation license = null, ResourceIdentifier sourceApiId = null, string displayName = null, Uri serviceUri = null, string path = null, IEnumerable protocols = null, ApiVersionSetContractDetails apiVersionSet = null) + public static ProductApiData ProductApiData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, AuthenticationSettingsContract authenticationSettings = null, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames = null, ApiType? apiType = null, string apiRevision = null, string apiVersion = null, bool? isCurrent = null, bool? isOnline = null, string apiRevisionDescription = null, string apiVersionDescription = null, ResourceIdentifier apiVersionSetId = null, bool? isSubscriptionRequired = null, Uri termsOfServiceUri = null, ApiContactInformation contact = null, ApiLicenseInformation license = null, ResourceIdentifier sourceApiId = null, string displayName = null, Uri serviceUri = null, string path = null, IEnumerable protocols = null, ApiVersionSetContractDetails apiVersionSet = null, string provisioningState = null) { protocols ??= new List(); - return new ProductApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet); + return new ProductApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet, provisioningState); } /// Initializes a new instance of . @@ -1441,6 +1689,30 @@ public static SubscriptionContractData SubscriptionContractData(ResourceIdentifi return new SubscriptionContractData(id, name, resourceType, systemData, ownerId, scope, displayName, state, createdOn, startOn, expireOn, endOn, notifiesOn, primaryKey, secondaryKey, stateComment, allowTracing); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of an API. + /// A new instance for mocking. + public static ProductApiLinkContractData ProductApiLinkContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string apiId = null) + { + return new ProductApiLinkContractData(id, name, resourceType, systemData, apiId); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of a group. + /// A new instance for mocking. + public static ProductGroupLinkContractData ProductGroupLinkContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string groupId = null) + { + return new ProductGroupLinkContractData(id, name, resourceType, systemData, groupId); + } + /// Initializes a new instance of . /// The Key value of the Counter. Must not be empty. /// Identifier of the Period for which the counter was collected. Must not be empty. @@ -1496,7 +1768,7 @@ public static RegionContract RegionContract(string name = null, bool? isMasterRe /// Subscription identifier path. /subscriptions/{subscriptionId}. /// Number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. /// Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests. - /// Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. + /// Number of calls failed due to gateway or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. /// Number of other calls. /// Total number of calls. /// Bandwidth consumed. @@ -1548,10 +1820,11 @@ public static RequestReportRecordContract RequestReportRecordContract(string api /// Free-form schema entity description. /// Json-encoded string for non json-based schema. /// Global Schema document object for json-based schema formats(e.g. json schema). + /// The provisioning state. /// A new instance for mocking. - public static ApiManagementGlobalSchemaData ApiManagementGlobalSchemaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ApiSchemaType? schemaType = null, string description = null, BinaryData value = null, BinaryData document = null) + public static ApiManagementGlobalSchemaData ApiManagementGlobalSchemaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ApiSchemaType? schemaType = null, string description = null, BinaryData value = null, BinaryData document = null, string provisioningState = null) { - return new ApiManagementGlobalSchemaData(id, name, resourceType, systemData, schemaType, description, value, document); + return new ApiManagementGlobalSchemaData(id, name, resourceType, systemData, schemaType, description, value, document, provisioningState); } /// Initializes a new instance of . @@ -1684,6 +1957,42 @@ public static SubscriptionKeysContract SubscriptionKeysContract(string primaryKe return new SubscriptionKeysContract(primaryKey, secondaryKey); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of an API. + /// A new instance for mocking. + public static TagApiLinkContractData TagApiLinkContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string apiId = null) + { + return new TagApiLinkContractData(id, name, resourceType, systemData, apiId); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of an API operation. + /// A new instance for mocking. + public static TagOperationLinkContractData TagOperationLinkContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string operationId = null) + { + return new TagOperationLinkContractData(id, name, resourceType, systemData, operationId); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of a product. + /// A new instance for mocking. + public static TagProductLinkContractData TagProductLinkContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string productId = null) + { + return new TagProductLinkContractData(id, name, resourceType, systemData, productId); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -1710,42 +2019,6 @@ public static TenantAccessInfoSecretsDetails TenantAccessInfoSecretsDetails(stri return new TenantAccessInfoSecretsDetails(accessInfoType, principalId, primaryKey, secondaryKey, isDirectAccessEnabled); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Operation result identifier. - /// Status of an async operation. - /// - /// Start time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - /// - /// - /// - /// Last update time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - /// - /// - /// Optional result info. - /// Error Body Contract. - /// This property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation. - /// A new instance for mocking. - public static GitOperationResultContractData GitOperationResultContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string operationResultIdentifier = null, AsyncOperationStatus? status = null, DateTimeOffset? startedOn = null, DateTimeOffset? updatedOn = null, string resultInfo = null, ErrorResponseBody error = null, IEnumerable actionLog = null) - { - actionLog ??= new List(); - - return new GitOperationResultContractData(id, name, resourceType, systemData, operationResultIdentifier, status, startedOn, updatedOn, resultInfo, error, actionLog?.ToList()); - } - - /// Initializes a new instance of . - /// The type of entity contract. - /// Action like create/update/delete. - /// Identifier of the entity being created/updated/deleted. - /// A new instance for mocking. - public static OperationResultLogItemContract OperationResultLogItemContract(string objectType = null, string action = null, string objectKey = null) - { - return new OperationResultLogItemContract(objectType, action, objectKey); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -1786,5 +2059,18 @@ public static UserTokenResult UserTokenResult(string value = null) { return new UserTokenResult(value); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Name of the workspace. + /// Description of the workspace. + /// A new instance for mocking. + public static WorkspaceContractData WorkspaceContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string description = null) + { + return new WorkspaceContractData(id, name, resourceType, systemData, displayName, description); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractCollection.cs new file mode 100644 index 000000000000..0822d169766a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAuthorizationAccessPolicyContracts method from an instance of . + /// + public partial class AuthorizationAccessPolicyContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics; + private readonly AuthorizationAccessPolicyRestOperations _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationAccessPolicyContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal AuthorizationAccessPolicyContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", AuthorizationAccessPolicyContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AuthorizationAccessPolicyContractResource.ResourceType, out string authorizationAccessPolicyContractAuthorizationAccessPolicyApiVersion); + _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient = new AuthorizationAccessPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationAccessPolicyContractAuthorizationAccessPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != AuthorizationContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AuthorizationContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates Authorization Access Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization access policy. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates Authorization Access Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization access policy. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.Get"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.Get"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of authorization access policy defined within a authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_ListByAuthorization + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateListByAuthorizationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateListByAuthorizationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AuthorizationAccessPolicyContractResource(Client, AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(e)), _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics, Pipeline, "AuthorizationAccessPolicyContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of authorization access policy defined within a authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_ListByAuthorization + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateListByAuthorizationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateListByAuthorizationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AuthorizationAccessPolicyContractResource(Client, AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(e)), _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics, Pipeline, "AuthorizationAccessPolicyContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.Exists"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.Exists"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractData.cs new file mode 100644 index 000000000000..a63f70750bac --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractData.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the AuthorizationAccessPolicyContract data model. + /// Authorization access policy contract. + /// + public partial class AuthorizationAccessPolicyContractData : ResourceData + { + /// Initializes a new instance of . + public AuthorizationAccessPolicyContractData() + { + AppIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The allowed Azure Active Directory Application IDs. + /// The Tenant Id. + /// The Object Id. + internal AuthorizationAccessPolicyContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList appIds, Guid? tenantId, string objectId) : base(id, name, resourceType, systemData) + { + AppIds = appIds; + TenantId = tenantId; + ObjectId = objectId; + } + + /// The allowed Azure Active Directory Application IDs. + public IList AppIds { get; } + /// The Tenant Id. + public Guid? TenantId { get; set; } + /// The Object Id. + public string ObjectId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractResource.cs new file mode 100644 index 000000000000..34b2f3c788fc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractResource.cs @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing an AuthorizationAccessPolicyContract along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAuthorizationAccessPolicyContractResource method. + /// Otherwise you can get one from its parent resource using the GetAuthorizationAccessPolicyContract method. + /// + public partial class AuthorizationAccessPolicyContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The authorizationProviderId. + /// The authorizationId. + /// The authorizationAccessPolicyId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics; + private readonly AuthorizationAccessPolicyRestOperations _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient; + private readonly AuthorizationAccessPolicyContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/authorizationProviders/authorizations/accessPolicies"; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationAccessPolicyContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AuthorizationAccessPolicyContractResource(ArmClient client, AuthorizationAccessPolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal AuthorizationAccessPolicyContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string authorizationAccessPolicyContractAuthorizationAccessPolicyApiVersion); + _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient = new AuthorizationAccessPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationAccessPolicyContractAuthorizationAccessPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual AuthorizationAccessPolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Get"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Get"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific access policy from the Authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Delete"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific access policy from the Authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Delete"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates Authorization Access Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Update"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates Authorization Access Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Update"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractCollection.cs new file mode 100644 index 000000000000..a9530aa8ddd3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAuthorizationContracts method from an instance of . + /// + public partial class AuthorizationContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _authorizationContractAuthorizationClientDiagnostics; + private readonly AuthorizationRestOperations _authorizationContractAuthorizationRestClient; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal AuthorizationContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationContractAuthorizationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", AuthorizationContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AuthorizationContractResource.ResourceType, out string authorizationContractAuthorizationApiVersion); + _authorizationContractAuthorizationRestClient = new AuthorizationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationContractAuthorizationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != AuthorizationProviderContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AuthorizationProviderContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationId, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationId, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.Get"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.Get"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of authorization providers defined within a authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations + /// + /// + /// Operation Id + /// Authorization_ListByAuthorizationProvider + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationContractAuthorizationRestClient.CreateListByAuthorizationProviderRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationContractAuthorizationRestClient.CreateListByAuthorizationProviderNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AuthorizationContractResource(Client, AuthorizationContractData.DeserializeAuthorizationContractData(e)), _authorizationContractAuthorizationClientDiagnostics, Pipeline, "AuthorizationContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of authorization providers defined within a authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations + /// + /// + /// Operation Id + /// Authorization_ListByAuthorizationProvider + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationContractAuthorizationRestClient.CreateListByAuthorizationProviderRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationContractAuthorizationRestClient.CreateListByAuthorizationProviderNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AuthorizationContractResource(Client, AuthorizationContractData.DeserializeAuthorizationContractData(e)), _authorizationContractAuthorizationClientDiagnostics, Pipeline, "AuthorizationContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.Exists"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.Exists"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractData.cs new file mode 100644 index 000000000000..ca0d537d1093 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractData.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the AuthorizationContract data model. + /// Authorization contract. + /// + public partial class AuthorizationContractData : ResourceData + { + /// Initializes a new instance of . + public AuthorizationContractData() + { + Parameters = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Authorization type options. + /// OAuth2 grant type options. + /// Authorization parameters. + /// Authorization error details. + /// Status of the Authorization. + internal AuthorizationContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AuthorizationType? authorizationType, OAuth2GrantType? oAuth2GrantType, IDictionary parameters, AuthorizationError error, string status) : base(id, name, resourceType, systemData) + { + AuthorizationType = authorizationType; + OAuth2GrantType = oAuth2GrantType; + Parameters = parameters; + Error = error; + Status = status; + } + + /// Authorization type options. + public AuthorizationType? AuthorizationType { get; set; } + /// OAuth2 grant type options. + public OAuth2GrantType? OAuth2GrantType { get; set; } + /// Authorization parameters. + public IDictionary Parameters { get; } + /// Authorization error details. + public AuthorizationError Error { get; set; } + /// Status of the Authorization. + public string Status { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractResource.cs new file mode 100644 index 000000000000..511f1bcf6356 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractResource.cs @@ -0,0 +1,500 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing an AuthorizationContract along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAuthorizationContractResource method. + /// Otherwise you can get one from its parent resource using the GetAuthorizationContract method. + /// + public partial class AuthorizationContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The authorizationProviderId. + /// The authorizationId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _authorizationContractAuthorizationClientDiagnostics; + private readonly AuthorizationRestOperations _authorizationContractAuthorizationRestClient; + private readonly ClientDiagnostics _authorizationLoginLinksClientDiagnostics; + private readonly AuthorizationLoginLinksRestOperations _authorizationLoginLinksRestClient; + private readonly AuthorizationContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/authorizationProviders/authorizations"; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AuthorizationContractResource(ArmClient client, AuthorizationContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal AuthorizationContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationContractAuthorizationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string authorizationContractAuthorizationApiVersion); + _authorizationContractAuthorizationRestClient = new AuthorizationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationContractAuthorizationApiVersion); + _authorizationLoginLinksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _authorizationLoginLinksRestClient = new AuthorizationLoginLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual AuthorizationContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of AuthorizationAccessPolicyContractResources in the AuthorizationContract. + /// An object representing collection of AuthorizationAccessPolicyContractResources and their operations over a AuthorizationAccessPolicyContractResource. + public virtual AuthorizationAccessPolicyContractCollection GetAuthorizationAccessPolicyContracts() + { + return GetCachedClient(client => new AuthorizationAccessPolicyContractCollection(client, Id)); + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAuthorizationAccessPolicyContractAsync(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + return await GetAuthorizationAccessPolicyContracts().GetAsync(authorizationAccessPolicyId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAuthorizationAccessPolicyContract(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + return GetAuthorizationAccessPolicyContracts().Get(authorizationAccessPolicyId, cancellationToken); + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Get"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Get"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Authorization from the Authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Delete"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Authorization from the Authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Delete"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Update"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Update"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Confirm valid consent code to suppress Authorizations anti-phishing page. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/confirmConsentCode + /// + /// + /// Operation Id + /// Authorization_ConfirmConsentCode + /// + /// + /// + /// Create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task ConfirmConsentCodeAsync(AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(authorizationConfirmConsentCodeRequestContract, nameof(authorizationConfirmConsentCodeRequestContract)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.ConfirmConsentCode"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.ConfirmConsentCodeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationConfirmConsentCodeRequestContract, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Confirm valid consent code to suppress Authorizations anti-phishing page. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/confirmConsentCode + /// + /// + /// Operation Id + /// Authorization_ConfirmConsentCode + /// + /// + /// + /// Create parameters. + /// The cancellation token to use. + /// is null. + public virtual Response ConfirmConsentCode(AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(authorizationConfirmConsentCodeRequestContract, nameof(authorizationConfirmConsentCodeRequestContract)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.ConfirmConsentCode"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.ConfirmConsentCode(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationConfirmConsentCodeRequestContract, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets authorization login links. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks + /// + /// + /// Operation Id + /// AuthorizationLoginLinks_Post + /// + /// + /// + /// Create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> PostAuthorizationLoginLinkAsync(AuthorizationLoginRequestContract authorizationLoginRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(authorizationLoginRequestContract, nameof(authorizationLoginRequestContract)); + + using var scope = _authorizationLoginLinksClientDiagnostics.CreateScope("AuthorizationContractResource.PostAuthorizationLoginLink"); + scope.Start(); + try + { + var response = await _authorizationLoginLinksRestClient.PostAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationLoginRequestContract, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets authorization login links. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks + /// + /// + /// Operation Id + /// AuthorizationLoginLinks_Post + /// + /// + /// + /// Create parameters. + /// The cancellation token to use. + /// is null. + public virtual Response PostAuthorizationLoginLink(AuthorizationLoginRequestContract authorizationLoginRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(authorizationLoginRequestContract, nameof(authorizationLoginRequestContract)); + + using var scope = _authorizationLoginLinksClientDiagnostics.CreateScope("AuthorizationContractResource.PostAuthorizationLoginLink"); + scope.Start(); + try + { + var response = _authorizationLoginLinksRestClient.Post(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationLoginRequestContract, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractCollection.cs new file mode 100644 index 000000000000..1434de562142 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAuthorizationProviderContracts method from an instance of . + /// + public partial class AuthorizationProviderContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _authorizationProviderContractAuthorizationProviderClientDiagnostics; + private readonly AuthorizationProviderRestOperations _authorizationProviderContractAuthorizationProviderRestClient; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationProviderContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal AuthorizationProviderContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationProviderContractAuthorizationProviderClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", AuthorizationProviderContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AuthorizationProviderContractResource.ResourceType, out string authorizationProviderContractAuthorizationProviderApiVersion); + _authorizationProviderContractAuthorizationProviderRestClient = new AuthorizationProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationProviderContractAuthorizationProviderApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization provider. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationProviderContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization provider. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationProviderContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.Get"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.Get"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of authorization providers defined within a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders + /// + /// + /// Operation Id + /// AuthorizationProvider_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationProviderContractAuthorizationProviderRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationProviderContractAuthorizationProviderRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AuthorizationProviderContractResource(Client, AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(e)), _authorizationProviderContractAuthorizationProviderClientDiagnostics, Pipeline, "AuthorizationProviderContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of authorization providers defined within a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders + /// + /// + /// Operation Id + /// AuthorizationProvider_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationProviderContractAuthorizationProviderRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationProviderContractAuthorizationProviderRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AuthorizationProviderContractResource(Client, AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(e)), _authorizationProviderContractAuthorizationProviderClientDiagnostics, Pipeline, "AuthorizationProviderContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.Exists"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.Exists"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractData.cs new file mode 100644 index 000000000000..f13078ad1dfc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the AuthorizationProviderContract data model. + /// Authorization Provider contract. + /// + public partial class AuthorizationProviderContractData : ResourceData + { + /// Initializes a new instance of . + public AuthorizationProviderContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Authorization Provider name. Must be 1 to 300 characters long. + /// Identity provider name. Must be 1 to 300 characters long. + /// OAuth2 settings. + internal AuthorizationProviderContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string identityProvider, AuthorizationProviderOAuth2Settings oauth2) : base(id, name, resourceType, systemData) + { + DisplayName = displayName; + IdentityProvider = identityProvider; + Oauth2 = oauth2; + } + + /// Authorization Provider name. Must be 1 to 300 characters long. + public string DisplayName { get; set; } + /// Identity provider name. Must be 1 to 300 characters long. + public string IdentityProvider { get; set; } + /// OAuth2 settings. + public AuthorizationProviderOAuth2Settings Oauth2 { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractResource.cs new file mode 100644 index 000000000000..9cd31eb432cd --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractResource.cs @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing an AuthorizationProviderContract along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAuthorizationProviderContractResource method. + /// Otherwise you can get one from its parent resource using the GetAuthorizationProviderContract method. + /// + public partial class AuthorizationProviderContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The authorizationProviderId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _authorizationProviderContractAuthorizationProviderClientDiagnostics; + private readonly AuthorizationProviderRestOperations _authorizationProviderContractAuthorizationProviderRestClient; + private readonly AuthorizationProviderContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/authorizationProviders"; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationProviderContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AuthorizationProviderContractResource(ArmClient client, AuthorizationProviderContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal AuthorizationProviderContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationProviderContractAuthorizationProviderClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string authorizationProviderContractAuthorizationProviderApiVersion); + _authorizationProviderContractAuthorizationProviderRestClient = new AuthorizationProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationProviderContractAuthorizationProviderApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual AuthorizationProviderContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of AuthorizationContractResources in the AuthorizationProviderContract. + /// An object representing collection of AuthorizationContractResources and their operations over a AuthorizationContractResource. + public virtual AuthorizationContractCollection GetAuthorizationContracts() + { + return GetCachedClient(client => new AuthorizationContractCollection(client, Id)); + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAuthorizationContractAsync(string authorizationId, CancellationToken cancellationToken = default) + { + return await GetAuthorizationContracts().GetAsync(authorizationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAuthorizationContract(string authorizationId, CancellationToken cancellationToken = default) + { + return GetAuthorizationContracts().Get(authorizationId, cancellationToken); + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Get"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Get"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific authorization provider from the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Delete"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific authorization provider from the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Delete"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Update"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationProviderContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Update"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationProviderContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractCollection.cs new file mode 100644 index 000000000000..df8981f487d2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDocumentationContracts method from an instance of . + /// + public partial class DocumentationContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _documentationContractDocumentationClientDiagnostics; + private readonly DocumentationRestOperations _documentationContractDocumentationRestClient; + + /// Initializes a new instance of the class for mocking. + protected DocumentationContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal DocumentationContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _documentationContractDocumentationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", DocumentationContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DocumentationContractResource.ResourceType, out string documentationContractDocumentationApiVersion); + _documentationContractDocumentationRestClient = new DocumentationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, documentationContractDocumentationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new Documentation or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string documentationId, DocumentationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new DocumentationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Documentation or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string documentationId, DocumentationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new DocumentationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.Get"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.Get"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all Documentations of the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations + /// + /// + /// Operation Id + /// Documentation_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _documentationContractDocumentationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _documentationContractDocumentationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DocumentationContractResource(Client, DocumentationContractData.DeserializeDocumentationContractData(e)), _documentationContractDocumentationClientDiagnostics, Pipeline, "DocumentationContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all Documentations of the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations + /// + /// + /// Operation Id + /// Documentation_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _documentationContractDocumentationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _documentationContractDocumentationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DocumentationContractResource(Client, DocumentationContractData.DeserializeDocumentationContractData(e)), _documentationContractDocumentationClientDiagnostics, Pipeline, "DocumentationContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.Exists"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.Exists"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractData.cs new file mode 100644 index 000000000000..9ae9753bb464 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractData.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the DocumentationContract data model. + /// Markdown documentation details. + /// + public partial class DocumentationContractData : ResourceData + { + /// Initializes a new instance of . + public DocumentationContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// documentation title. + /// Markdown documentation content. + internal DocumentationContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string content) : base(id, name, resourceType, systemData) + { + Title = title; + Content = content; + } + + /// documentation title. + public string Title { get; set; } + /// Markdown documentation content. + public string Content { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractResource.cs new file mode 100644 index 000000000000..b1c55aabbea0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractResource.cs @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a DocumentationContract along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDocumentationContractResource method. + /// Otherwise you can get one from its parent resource using the GetDocumentationContract method. + /// + public partial class DocumentationContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The documentationId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string documentationId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _documentationContractDocumentationClientDiagnostics; + private readonly DocumentationRestOperations _documentationContractDocumentationRestClient; + private readonly DocumentationContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/documentations"; + + /// Initializes a new instance of the class for mocking. + protected DocumentationContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DocumentationContractResource(ArmClient client, DocumentationContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal DocumentationContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _documentationContractDocumentationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string documentationContractDocumentationApiVersion); + _documentationContractDocumentationRestClient = new DocumentationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, documentationContractDocumentationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DocumentationContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Get"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Get"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Documentation from an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Delete"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Documentation from an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Delete"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Documentation for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Documentation Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, DocumentationContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Update"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Documentation for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Documentation Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, DocumentationContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Update"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Documentation by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Documentation by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs index c0ac4a5f7843..68dc933cdaaa 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs @@ -36,60 +36,117 @@ private static MockableApiManagementSubscriptionResource GetMockableApiManagemen } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiResource GetApiResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceApiResource GetServiceApiResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiResource(id); + return GetMockableApiManagementArmClient(client).GetServiceApiResource(id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiReleaseResource GetApiReleaseResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceWorkspaceApiResource GetServiceWorkspaceApiResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiReleaseResource(id); + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceApiResource(id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiOperationResource GetApiOperationResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceApiReleaseResource GetServiceApiReleaseResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiOperationResource(id); + return GetMockableApiManagementArmClient(client).GetServiceApiReleaseResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceApiReleaseResource GetServiceWorkspaceApiReleaseResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceApiReleaseResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceApiOperationResource GetServiceApiOperationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceApiOperationResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceApiOperationResource GetServiceWorkspaceApiOperationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceApiOperationResource(id); } /// @@ -111,6 +168,25 @@ public static ApiOperationPolicyResource GetApiOperationPolicyResource(this ArmC return GetMockableApiManagementArmClient(client).GetApiOperationPolicyResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceApiResolverPolicyResource GetServiceApiResolverPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceApiResolverPolicyResource(id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -168,6 +244,82 @@ public static ApiManagementProductPolicyResource GetApiManagementProductPolicyRe return GetMockableApiManagementArmClient(client).GetApiManagementProductPolicyResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspacePolicyResource GetServiceWorkspacePolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspacePolicyResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceApiOperationPolicyResource GetServiceWorkspaceApiOperationPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceApiOperationPolicyResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceApiPolicyResource GetServiceWorkspaceApiPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceApiPolicyResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceProductPolicyResource GetServiceWorkspaceProductPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceProductPolicyResource(id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -245,22 +397,79 @@ public static ApiManagementTagResource GetApiManagementTagResource(this ArmClien } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceTagResource GetServiceWorkspaceTagResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceTagResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ResolverContractResource GetResolverContractResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetResolverContractResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceApiSchemaResource GetServiceApiSchemaResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceApiSchemaResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiSchemaResource GetApiSchemaResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceWorkspaceApiSchemaResource GetServiceWorkspaceApiSchemaResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiSchemaResource(id); + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceApiSchemaResource(id); } /// @@ -397,22 +606,136 @@ public static ApiTagDescriptionResource GetApiTagDescriptionResource(this ArmCli } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceApiWikiResource GetServiceApiWikiResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceApiWikiResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceProductWikiResource GetServiceProductWikiResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceProductWikiResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceApiVersionSetResource GetServiceApiVersionSetResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceApiVersionSetResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiVersionSetResource GetApiVersionSetResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceWorkspaceApiVersionSetResource GetServiceWorkspaceApiVersionSetResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiVersionSetResource(id); + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceApiVersionSetResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static AuthorizationProviderContractResource GetAuthorizationProviderContractResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetAuthorizationProviderContractResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static AuthorizationContractResource GetAuthorizationContractResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetAuthorizationContractResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static AuthorizationAccessPolicyContractResource GetAuthorizationAccessPolicyContractResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetAuthorizationAccessPolicyContractResource(id); } /// @@ -529,6 +852,25 @@ public static ApiManagementServiceResource GetApiManagementServiceResource(this return GetMockableApiManagementArmClient(client).GetApiManagementServiceResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DocumentationContractResource GetDocumentationContractResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetDocumentationContractResource(id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -606,22 +948,41 @@ public static ApiManagementGatewayCertificateAuthorityResource GetApiManagementG } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiManagementGroupResource GetApiManagementGroupResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceGroupResource GetServiceGroupResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiManagementGroupResource(id); + return GetMockableApiManagementArmClient(client).GetServiceGroupResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceGroupResource GetServiceWorkspaceGroupResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceGroupResource(id); } /// @@ -663,41 +1024,79 @@ public static ApiManagementLoggerResource GetApiManagementLoggerResource(this Ar } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiManagementNamedValueResource GetApiManagementNamedValueResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceNamedValueResource GetServiceNamedValueResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiManagementNamedValueResource(id); + return GetMockableApiManagementArmClient(client).GetServiceNamedValueResource(id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiManagementNotificationResource GetApiManagementNotificationResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceWorkspaceNamedValueResource GetServiceWorkspaceNamedValueResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiManagementNotificationResource(id); + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceNamedValueResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceNotificationResource GetServiceNotificationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceNotificationResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceNotificationResource GetServiceWorkspaceNotificationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceNotificationResource(id); } /// @@ -719,6 +1118,82 @@ public static ApiManagementOpenIdConnectProviderResource GetApiManagementOpenIdC return GetMockableApiManagementArmClient(client).GetApiManagementOpenIdConnectProviderResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServicePolicyFragmentResource GetServicePolicyFragmentResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServicePolicyFragmentResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspacePolicyFragmentResource GetServiceWorkspacePolicyFragmentResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspacePolicyFragmentResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static PolicyRestrictionContractResource GetPolicyRestrictionContractResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetPolicyRestrictionContractResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static PortalConfigContractResource GetPortalConfigContractResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetPortalConfigContractResource(id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -834,41 +1309,155 @@ public static ApiManagementPrivateLinkResource GetApiManagementPrivateLinkResour } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceProductResource GetServiceProductResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceProductResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiManagementProductResource GetApiManagementProductResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceWorkspaceProductResource GetServiceWorkspaceProductResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiManagementProductResource(id); + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceProductResource(id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ApiManagementGlobalSchemaResource GetApiManagementGlobalSchemaResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceProductApiLinkResource GetServiceProductApiLinkResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableApiManagementArmClient(client).GetApiManagementGlobalSchemaResource(id); + return GetMockableApiManagementArmClient(client).GetServiceProductApiLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceProductApiLinkResource GetServiceWorkspaceProductApiLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceProductApiLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceProductGroupLinkResource GetServiceProductGroupLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceProductGroupLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceProductGroupLinkResource GetServiceWorkspaceProductGroupLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceProductGroupLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceSchemaResource GetServiceSchemaResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceSchemaResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceSchemaResource GetServiceWorkspaceSchemaResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceSchemaResource(id); } /// @@ -928,6 +1517,139 @@ public static ApiManagementUserSubscriptionResource GetApiManagementUserSubscrip return GetMockableApiManagementArmClient(client).GetApiManagementUserSubscriptionResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceSubscriptionResource GetServiceWorkspaceSubscriptionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceSubscriptionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceTagApiLinkResource GetServiceTagApiLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceTagApiLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceTagApiLinkResource GetServiceWorkspaceTagApiLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceTagApiLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceTagOperationLinkResource GetServiceTagOperationLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceTagOperationLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceTagOperationLinkResource GetServiceWorkspaceTagOperationLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceTagOperationLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceTagProductLinkResource GetServiceTagProductLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceTagProductLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceWorkspaceTagProductLinkResource GetServiceWorkspaceTagProductLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetServiceWorkspaceTagProductLinkResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -966,6 +1688,25 @@ public static ApiManagementUserResource GetApiManagementUserResource(this ArmCli return GetMockableApiManagementArmClient(client).GetApiManagementUserResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static WorkspaceContractResource GetWorkspaceContractResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableApiManagementArmClient(client).GetWorkspaceContractResource(id); + } + /// /// Gets a collection of ApiManagementServiceResources in the ResourceGroupResource. /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementArmClient.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementArmClient.cs index 245b1dacee32..cad4e8ebe9d0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementArmClient.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementArmClient.cs @@ -37,39 +37,75 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiResource GetApiResource(ResourceIdentifier id) + /// Returns a object. + public virtual ServiceApiResource GetServiceApiResource(ResourceIdentifier id) { - ApiResource.ValidateResourceId(id); - return new ApiResource(Client, id); + ServiceApiResource.ValidateResourceId(id); + return new ServiceApiResource(Client, id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiReleaseResource GetApiReleaseResource(ResourceIdentifier id) + /// Returns a object. + public virtual ServiceWorkspaceApiResource GetServiceWorkspaceApiResource(ResourceIdentifier id) { - ApiReleaseResource.ValidateResourceId(id); - return new ApiReleaseResource(Client, id); + ServiceWorkspaceApiResource.ValidateResourceId(id); + return new ServiceWorkspaceApiResource(Client, id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiOperationResource GetApiOperationResource(ResourceIdentifier id) + /// Returns a object. + public virtual ServiceApiReleaseResource GetServiceApiReleaseResource(ResourceIdentifier id) { - ApiOperationResource.ValidateResourceId(id); - return new ApiOperationResource(Client, id); + ServiceApiReleaseResource.ValidateResourceId(id); + return new ServiceApiReleaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceApiReleaseResource GetServiceWorkspaceApiReleaseResource(ResourceIdentifier id) + { + ServiceWorkspaceApiReleaseResource.ValidateResourceId(id); + return new ServiceWorkspaceApiReleaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceApiOperationResource GetServiceApiOperationResource(ResourceIdentifier id) + { + ServiceApiOperationResource.ValidateResourceId(id); + return new ServiceApiOperationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceApiOperationResource GetServiceWorkspaceApiOperationResource(ResourceIdentifier id) + { + ServiceWorkspaceApiOperationResource.ValidateResourceId(id); + return new ServiceWorkspaceApiOperationResource(Client, id); } /// @@ -84,6 +120,18 @@ public virtual ApiOperationPolicyResource GetApiOperationPolicyResource(Resource return new ApiOperationPolicyResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceApiResolverPolicyResource GetServiceApiResolverPolicyResource(ResourceIdentifier id) + { + ServiceApiResolverPolicyResource.ValidateResourceId(id); + return new ServiceApiResolverPolicyResource(Client, id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -120,6 +168,54 @@ public virtual ApiManagementProductPolicyResource GetApiManagementProductPolicyR return new ApiManagementProductPolicyResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspacePolicyResource GetServiceWorkspacePolicyResource(ResourceIdentifier id) + { + ServiceWorkspacePolicyResource.ValidateResourceId(id); + return new ServiceWorkspacePolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceApiOperationPolicyResource GetServiceWorkspaceApiOperationPolicyResource(ResourceIdentifier id) + { + ServiceWorkspaceApiOperationPolicyResource.ValidateResourceId(id); + return new ServiceWorkspaceApiOperationPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceApiPolicyResource GetServiceWorkspaceApiPolicyResource(ResourceIdentifier id) + { + ServiceWorkspaceApiPolicyResource.ValidateResourceId(id); + return new ServiceWorkspaceApiPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceProductPolicyResource GetServiceWorkspaceProductPolicyResource(ResourceIdentifier id) + { + ServiceWorkspaceProductPolicyResource.ValidateResourceId(id); + return new ServiceWorkspaceProductPolicyResource(Client, id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -169,15 +265,51 @@ public virtual ApiManagementTagResource GetApiManagementTagResource(ResourceIden } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceTagResource GetServiceWorkspaceTagResource(ResourceIdentifier id) + { + ServiceWorkspaceTagResource.ValidateResourceId(id); + return new ServiceWorkspaceTagResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiSchemaResource GetApiSchemaResource(ResourceIdentifier id) + /// Returns a object. + public virtual ResolverContractResource GetResolverContractResource(ResourceIdentifier id) { - ApiSchemaResource.ValidateResourceId(id); - return new ApiSchemaResource(Client, id); + ResolverContractResource.ValidateResourceId(id); + return new ResolverContractResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceApiSchemaResource GetServiceApiSchemaResource(ResourceIdentifier id) + { + ServiceApiSchemaResource.ValidateResourceId(id); + return new ServiceApiSchemaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceApiSchemaResource GetServiceWorkspaceApiSchemaResource(ResourceIdentifier id) + { + ServiceWorkspaceApiSchemaResource.ValidateResourceId(id); + return new ServiceWorkspaceApiSchemaResource(Client, id); } /// @@ -265,15 +397,87 @@ public virtual ApiTagDescriptionResource GetApiTagDescriptionResource(ResourceId } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceApiWikiResource GetServiceApiWikiResource(ResourceIdentifier id) + { + ServiceApiWikiResource.ValidateResourceId(id); + return new ServiceApiWikiResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceProductWikiResource GetServiceProductWikiResource(ResourceIdentifier id) + { + ServiceProductWikiResource.ValidateResourceId(id); + return new ServiceProductWikiResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceApiVersionSetResource GetServiceApiVersionSetResource(ResourceIdentifier id) + { + ServiceApiVersionSetResource.ValidateResourceId(id); + return new ServiceApiVersionSetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceApiVersionSetResource GetServiceWorkspaceApiVersionSetResource(ResourceIdentifier id) + { + ServiceWorkspaceApiVersionSetResource.ValidateResourceId(id); + return new ServiceWorkspaceApiVersionSetResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual AuthorizationProviderContractResource GetAuthorizationProviderContractResource(ResourceIdentifier id) + { + AuthorizationProviderContractResource.ValidateResourceId(id); + return new AuthorizationProviderContractResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiVersionSetResource GetApiVersionSetResource(ResourceIdentifier id) + /// Returns a object. + public virtual AuthorizationContractResource GetAuthorizationContractResource(ResourceIdentifier id) { - ApiVersionSetResource.ValidateResourceId(id); - return new ApiVersionSetResource(Client, id); + AuthorizationContractResource.ValidateResourceId(id); + return new AuthorizationContractResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual AuthorizationAccessPolicyContractResource GetAuthorizationAccessPolicyContractResource(ResourceIdentifier id) + { + AuthorizationAccessPolicyContractResource.ValidateResourceId(id); + return new AuthorizationAccessPolicyContractResource(Client, id); } /// @@ -348,6 +552,18 @@ public virtual ApiManagementServiceResource GetApiManagementServiceResource(Reso return new ApiManagementServiceResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DocumentationContractResource GetDocumentationContractResource(ResourceIdentifier id) + { + DocumentationContractResource.ValidateResourceId(id); + return new DocumentationContractResource(Client, id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -397,15 +613,27 @@ public virtual ApiManagementGatewayCertificateAuthorityResource GetApiManagement } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceGroupResource GetServiceGroupResource(ResourceIdentifier id) + { + ServiceGroupResource.ValidateResourceId(id); + return new ServiceGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiManagementGroupResource GetApiManagementGroupResource(ResourceIdentifier id) + /// Returns a object. + public virtual ServiceWorkspaceGroupResource GetServiceWorkspaceGroupResource(ResourceIdentifier id) { - ApiManagementGroupResource.ValidateResourceId(id); - return new ApiManagementGroupResource(Client, id); + ServiceWorkspaceGroupResource.ValidateResourceId(id); + return new ServiceWorkspaceGroupResource(Client, id); } /// @@ -433,27 +661,51 @@ public virtual ApiManagementLoggerResource GetApiManagementLoggerResource(Resour } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceNamedValueResource GetServiceNamedValueResource(ResourceIdentifier id) + { + ServiceNamedValueResource.ValidateResourceId(id); + return new ServiceNamedValueResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiManagementNamedValueResource GetApiManagementNamedValueResource(ResourceIdentifier id) + /// Returns a object. + public virtual ServiceWorkspaceNamedValueResource GetServiceWorkspaceNamedValueResource(ResourceIdentifier id) { - ApiManagementNamedValueResource.ValidateResourceId(id); - return new ApiManagementNamedValueResource(Client, id); + ServiceWorkspaceNamedValueResource.ValidateResourceId(id); + return new ServiceWorkspaceNamedValueResource(Client, id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiManagementNotificationResource GetApiManagementNotificationResource(ResourceIdentifier id) + /// Returns a object. + public virtual ServiceNotificationResource GetServiceNotificationResource(ResourceIdentifier id) { - ApiManagementNotificationResource.ValidateResourceId(id); - return new ApiManagementNotificationResource(Client, id); + ServiceNotificationResource.ValidateResourceId(id); + return new ServiceNotificationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceNotificationResource GetServiceWorkspaceNotificationResource(ResourceIdentifier id) + { + ServiceWorkspaceNotificationResource.ValidateResourceId(id); + return new ServiceWorkspaceNotificationResource(Client, id); } /// @@ -468,6 +720,54 @@ public virtual ApiManagementOpenIdConnectProviderResource GetApiManagementOpenId return new ApiManagementOpenIdConnectProviderResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServicePolicyFragmentResource GetServicePolicyFragmentResource(ResourceIdentifier id) + { + ServicePolicyFragmentResource.ValidateResourceId(id); + return new ServicePolicyFragmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspacePolicyFragmentResource GetServiceWorkspacePolicyFragmentResource(ResourceIdentifier id) + { + ServiceWorkspacePolicyFragmentResource.ValidateResourceId(id); + return new ServiceWorkspacePolicyFragmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PolicyRestrictionContractResource GetPolicyRestrictionContractResource(ResourceIdentifier id) + { + PolicyRestrictionContractResource.ValidateResourceId(id); + return new PolicyRestrictionContractResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PortalConfigContractResource GetPortalConfigContractResource(ResourceIdentifier id) + { + PortalConfigContractResource.ValidateResourceId(id); + return new PortalConfigContractResource(Client, id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -541,27 +841,99 @@ public virtual ApiManagementPrivateLinkResource GetApiManagementPrivateLinkResou } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceProductResource GetServiceProductResource(ResourceIdentifier id) + { + ServiceProductResource.ValidateResourceId(id); + return new ServiceProductResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceProductResource GetServiceWorkspaceProductResource(ResourceIdentifier id) + { + ServiceWorkspaceProductResource.ValidateResourceId(id); + return new ServiceWorkspaceProductResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiManagementProductResource GetApiManagementProductResource(ResourceIdentifier id) + /// Returns a object. + public virtual ServiceProductApiLinkResource GetServiceProductApiLinkResource(ResourceIdentifier id) { - ApiManagementProductResource.ValidateResourceId(id); - return new ApiManagementProductResource(Client, id); + ServiceProductApiLinkResource.ValidateResourceId(id); + return new ServiceProductApiLinkResource(Client, id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ApiManagementGlobalSchemaResource GetApiManagementGlobalSchemaResource(ResourceIdentifier id) + /// Returns a object. + public virtual ServiceWorkspaceProductApiLinkResource GetServiceWorkspaceProductApiLinkResource(ResourceIdentifier id) { - ApiManagementGlobalSchemaResource.ValidateResourceId(id); - return new ApiManagementGlobalSchemaResource(Client, id); + ServiceWorkspaceProductApiLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceProductApiLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceProductGroupLinkResource GetServiceProductGroupLinkResource(ResourceIdentifier id) + { + ServiceProductGroupLinkResource.ValidateResourceId(id); + return new ServiceProductGroupLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceProductGroupLinkResource GetServiceWorkspaceProductGroupLinkResource(ResourceIdentifier id) + { + ServiceWorkspaceProductGroupLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceProductGroupLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceSchemaResource GetServiceSchemaResource(ResourceIdentifier id) + { + ServiceSchemaResource.ValidateResourceId(id); + return new ServiceSchemaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceSchemaResource GetServiceWorkspaceSchemaResource(ResourceIdentifier id) + { + ServiceWorkspaceSchemaResource.ValidateResourceId(id); + return new ServiceWorkspaceSchemaResource(Client, id); } /// @@ -600,6 +972,90 @@ public virtual ApiManagementUserSubscriptionResource GetApiManagementUserSubscri return new ApiManagementUserSubscriptionResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceSubscriptionResource GetServiceWorkspaceSubscriptionResource(ResourceIdentifier id) + { + ServiceWorkspaceSubscriptionResource.ValidateResourceId(id); + return new ServiceWorkspaceSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceTagApiLinkResource GetServiceTagApiLinkResource(ResourceIdentifier id) + { + ServiceTagApiLinkResource.ValidateResourceId(id); + return new ServiceTagApiLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceTagApiLinkResource GetServiceWorkspaceTagApiLinkResource(ResourceIdentifier id) + { + ServiceWorkspaceTagApiLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceTagApiLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceTagOperationLinkResource GetServiceTagOperationLinkResource(ResourceIdentifier id) + { + ServiceTagOperationLinkResource.ValidateResourceId(id); + return new ServiceTagOperationLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceTagOperationLinkResource GetServiceWorkspaceTagOperationLinkResource(ResourceIdentifier id) + { + ServiceWorkspaceTagOperationLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceTagOperationLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceTagProductLinkResource GetServiceTagProductLinkResource(ResourceIdentifier id) + { + ServiceTagProductLinkResource.ValidateResourceId(id); + return new ServiceTagProductLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceWorkspaceTagProductLinkResource GetServiceWorkspaceTagProductLinkResource(ResourceIdentifier id) + { + ServiceWorkspaceTagProductLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceTagProductLinkResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -623,5 +1079,17 @@ public virtual ApiManagementUserResource GetApiManagementUserResource(ResourceId ApiManagementUserResource.ValidateResourceId(id); return new ApiManagementUserResource(Client, id); } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkspaceContractResource GetWorkspaceContractResource(ResourceIdentifier id) + { + WorkspaceContractResource.ValidateResourceId(id); + return new WorkspaceContractResource(Client, id); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiOperationSource.cs similarity index 60% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiOperationSource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiOperationSource.cs index bcb8db5c7bf5..1ee2baf8cd7e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiOperationSource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiOperationSource.cs @@ -14,27 +14,27 @@ namespace Azure.ResourceManager.ApiManagement { - internal class ApiOperationSource : IOperationSource + internal class ServiceApiOperationSource : IOperationSource { private readonly ArmClient _client; - internal ApiOperationSource(ArmClient client) + internal ServiceApiOperationSource(ArmClient client) { _client = client; } - ApiResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ServiceApiResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ApiData.DeserializeApiData(document.RootElement); - return new ApiResource(_client, data); + return new ServiceApiResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); var data = ApiData.DeserializeApiData(document.RootElement); - return new ApiResource(_client, data); + return new ServiceApiResource(_client, data); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiSchemaOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiSchemaOperationSource.cs similarity index 58% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiSchemaOperationSource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiSchemaOperationSource.cs index bcc57a7e7b4c..8d1d9b1823e3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiSchemaOperationSource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiSchemaOperationSource.cs @@ -14,27 +14,27 @@ namespace Azure.ResourceManager.ApiManagement { - internal class ApiSchemaOperationSource : IOperationSource + internal class ServiceApiSchemaOperationSource : IOperationSource { private readonly ArmClient _client; - internal ApiSchemaOperationSource(ArmClient client) + internal ServiceApiSchemaOperationSource(ArmClient client) { _client = client; } - ApiSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ServiceApiSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); - return new ApiSchemaResource(_client, data); + return new ServiceApiSchemaResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); var data = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); - return new ApiSchemaResource(_client, data); + return new ServiceApiSchemaResource(_client, data); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementNamedValueOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceNamedValueOperationSource.cs similarity index 57% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementNamedValueOperationSource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceNamedValueOperationSource.cs index 030c49c75c74..5054207725d4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementNamedValueOperationSource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceNamedValueOperationSource.cs @@ -14,27 +14,27 @@ namespace Azure.ResourceManager.ApiManagement { - internal class ApiManagementNamedValueOperationSource : IOperationSource + internal class ServiceNamedValueOperationSource : IOperationSource { private readonly ArmClient _client; - internal ApiManagementNamedValueOperationSource(ArmClient client) + internal ServiceNamedValueOperationSource(ArmClient client) { _client = client; } - ApiManagementNamedValueResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ServiceNamedValueResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); - return new ApiManagementNamedValueResource(_client, data); + return new ServiceNamedValueResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); var data = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); - return new ApiManagementNamedValueResource(_client, data); + return new ServiceNamedValueResource(_client, data); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServicePolicyFragmentOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServicePolicyFragmentOperationSource.cs new file mode 100644 index 000000000000..19680fe884f7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServicePolicyFragmentOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServicePolicyFragmentOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServicePolicyFragmentOperationSource(ArmClient client) + { + _client = client; + } + + ServicePolicyFragmentResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return new ServicePolicyFragmentResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return new ServicePolicyFragmentResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementGlobalSchemaOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceSchemaOperationSource.cs similarity index 57% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementGlobalSchemaOperationSource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceSchemaOperationSource.cs index 68f112f35795..f9e3affef327 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementGlobalSchemaOperationSource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceSchemaOperationSource.cs @@ -14,27 +14,27 @@ namespace Azure.ResourceManager.ApiManagement { - internal class ApiManagementGlobalSchemaOperationSource : IOperationSource + internal class ServiceSchemaOperationSource : IOperationSource { private readonly ArmClient _client; - internal ApiManagementGlobalSchemaOperationSource(ArmClient client) + internal ServiceSchemaOperationSource(ArmClient client) { _client = client; } - ApiManagementGlobalSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ServiceSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); - return new ApiManagementGlobalSchemaResource(_client, data); + return new ServiceSchemaResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); var data = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); - return new ApiManagementGlobalSchemaResource(_client, data); + return new ServiceSchemaResource(_client, data); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiOperationSource.cs new file mode 100644 index 000000000000..8318a3b28a63 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspaceApiOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspaceApiOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspaceApiResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ApiData.DeserializeApiData(document.RootElement); + return new ServiceWorkspaceApiResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ApiData.DeserializeApiData(document.RootElement); + return new ServiceWorkspaceApiResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiSchemaOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiSchemaOperationSource.cs new file mode 100644 index 000000000000..2af015cf0e2e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiSchemaOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspaceApiSchemaOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspaceApiSchemaOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspaceApiSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); + return new ServiceWorkspaceApiSchemaResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); + return new ServiceWorkspaceApiSchemaResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceNamedValueOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceNamedValueOperationSource.cs new file mode 100644 index 000000000000..b6bee9c6eea5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceNamedValueOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspaceNamedValueOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspaceNamedValueOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspaceNamedValueResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); + return new ServiceWorkspaceNamedValueResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); + return new ServiceWorkspaceNamedValueResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspacePolicyFragmentOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspacePolicyFragmentOperationSource.cs new file mode 100644 index 000000000000..b19427886bcf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspacePolicyFragmentOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspacePolicyFragmentOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspacePolicyFragmentOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspacePolicyFragmentResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return new ServiceWorkspacePolicyFragmentResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return new ServiceWorkspacePolicyFragmentResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceSchemaOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceSchemaOperationSource.cs new file mode 100644 index 000000000000..3d0d2d9c4110 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceSchemaOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspaceSchemaOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspaceSchemaOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspaceSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); + return new ServiceWorkspaceSchemaResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); + return new ServiceWorkspaceSchemaResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs index d03e24dd283f..3a34549292a8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs @@ -42,6 +42,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("virtualNetworkConfiguration"u8); writer.WriteObjectValue(VirtualNetworkConfiguration); } + if (Optional.IsDefined(NatGatewayState)) + { + writer.WritePropertyName("natGatewayState"u8); + writer.WriteStringValue(NatGatewayState.Value.ToString()); + } if (Optional.IsDefined(DisableGateway)) { writer.WritePropertyName("disableGateway"u8); @@ -64,6 +69,8 @@ internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement ele Optional publicIPAddressId = default; Optional virtualNetworkConfiguration = default; Optional gatewayRegionalUri = default; + Optional natGatewayState = default; + Optional> outboundPublicIPAddresses = default; Optional disableGateway = default; Optional platformVersion = default; foreach (var property in element.EnumerateObject()) @@ -161,6 +168,29 @@ internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement ele gatewayRegionalUri = new Uri(property.Value.GetString()); continue; } + if (property.NameEquals("natGatewayState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + natGatewayState = new NatGatewayState(property.Value.GetString()); + continue; + } + if (property.NameEquals("outboundPublicIPAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + outboundPublicIPAddresses = array; + continue; + } if (property.NameEquals("disableGateway"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -180,7 +210,7 @@ internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement ele continue; } } - return new AdditionalLocation(location, sku, Optional.ToList(zones), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, virtualNetworkConfiguration.Value, gatewayRegionalUri.Value, Optional.ToNullable(disableGateway), Optional.ToNullable(platformVersion)); + return new AdditionalLocation(location, sku, Optional.ToList(zones), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, virtualNetworkConfiguration.Value, gatewayRegionalUri.Value, Optional.ToNullable(natGatewayState), Optional.ToList(outboundPublicIPAddresses), Optional.ToNullable(disableGateway), Optional.ToNullable(platformVersion)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs index 7c7bcfd4062f..f24fe8449b98 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs @@ -28,6 +28,7 @@ public AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPropert Zones = new ChangeTrackingList(); PublicIPAddresses = new ChangeTrackingList(); PrivateIPAddresses = new ChangeTrackingList(); + OutboundPublicIPAddresses = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -39,9 +40,11 @@ public AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPropert /// Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the location. Supported only for Premium SKU being deployed in Virtual Network. /// Virtual network configuration for the location. /// Gateway URL of the API Management service in the Region. + /// Property can be used to enable NAT Gateway for this API Management service. + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. /// Compute Platform Version running the service. - internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuProperties sku, IList zones, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, VirtualNetworkConfiguration virtualNetworkConfiguration, Uri gatewayRegionalUri, bool? disableGateway, PlatformVersion? platformVersion) + internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuProperties sku, IList zones, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, VirtualNetworkConfiguration virtualNetworkConfiguration, Uri gatewayRegionalUri, NatGatewayState? natGatewayState, IReadOnlyList outboundPublicIPAddresses, bool? disableGateway, PlatformVersion? platformVersion) { Location = location; Sku = sku; @@ -51,6 +54,8 @@ internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPrope PublicIPAddressId = publicIPAddressId; VirtualNetworkConfiguration = virtualNetworkConfiguration; GatewayRegionalUri = gatewayRegionalUri; + NatGatewayState = natGatewayState; + OutboundPublicIPAddresses = outboundPublicIPAddresses; DisableGateway = disableGateway; PlatformVersion = platformVersion; } @@ -71,6 +76,10 @@ internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPrope public VirtualNetworkConfiguration VirtualNetworkConfiguration { get; set; } /// Gateway URL of the API Management service in the Region. public Uri GatewayRegionalUri { get; } + /// Property can be used to enable NAT Gateway for this API Management service. + public NatGatewayState? NatGatewayState { get; set; } + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. + public IReadOnlyList OutboundPublicIPAddresses { get; } /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. public bool? DisableGateway { get; set; } /// Compute Platform Version running the service. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesContract.Serialization.cs new file mode 100644 index 000000000000..cfa006a9df84 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesContract.Serialization.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AllPoliciesContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ReferencePolicyId)) + { + writer.WritePropertyName("referencePolicyId"u8); + writer.WriteStringValue(ReferencePolicyId); + } + if (Optional.IsDefined(ComplianceState)) + { + writer.WritePropertyName("complianceState"u8); + writer.WriteStringValue(ComplianceState.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AllPoliciesContract DeserializeAllPoliciesContract(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional referencePolicyId = default; + Optional complianceState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("referencePolicyId"u8)) + { + referencePolicyId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("complianceState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + complianceState = new PolicyComplianceState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new AllPoliciesContract(id, name, type, systemData.Value, referencePolicyId.Value, Optional.ToNullable(complianceState)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesContract.cs new file mode 100644 index 000000000000..303da9f402b7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesContract.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// AllPolicies Contract details. + public partial class AllPoliciesContract : ResourceData + { + /// Initializes a new instance of . + public AllPoliciesContract() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Policy Identifier. + /// Policy Restriction Compliance State. + internal AllPoliciesContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string referencePolicyId, PolicyComplianceState? complianceState) : base(id, name, resourceType, systemData) + { + ReferencePolicyId = referencePolicyId; + ComplianceState = complianceState; + } + + /// Policy Identifier. + public string ReferencePolicyId { get; set; } + /// Policy Restriction Compliance State. + public PolicyComplianceState? ComplianceState { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesListResult.Serialization.cs new file mode 100644 index 000000000000..6e640b1129c4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesListResult.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class AllPoliciesListResult + { + internal static AllPoliciesListResult DeserializeAllPoliciesListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AllPoliciesContract.DeserializeAllPoliciesContract(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new AllPoliciesListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesListResult.cs new file mode 100644 index 000000000000..08ae92adc6ae --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AllPoliciesListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The response of All Policies. + internal partial class AllPoliciesListResult + { + /// Initializes a new instance of . + internal AllPoliciesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// AllPolicies Contract value. + /// Next page link if any. + internal AllPoliciesListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// AllPolicies Contract value. + public IReadOnlyList Value { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.Serialization.cs similarity index 93% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.Serialization.cs index 9bf70c043dd9..ae27ebfa1df6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiCreateOrUpdateParameter : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -142,6 +142,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("apiType"u8); writer.WriteStringValue(SoapApiType.Value.ToString()); } + if (Optional.IsDefined(TranslateRequiredQueryParametersConduct)) + { + writer.WritePropertyName("translateRequiredQueryParameters"u8); + writer.WriteStringValue(TranslateRequiredQueryParametersConduct.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs similarity index 79% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs index d5c5cfdad20f..3f3e6c81cec8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs @@ -12,15 +12,15 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// API Create or Update Parameters. - public partial class ApiCreateOrUpdateContent + public partial class ApiCreateOrUpdateParameter { - /// Initializes a new instance of . - public ApiCreateOrUpdateContent() + /// Initializes a new instance of . + public ApiCreateOrUpdateParameter() { Protocols = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Description of the API. May include HTML formatting tags. /// Collection of authentication settings included into this API. /// Protocols over which API is made available. @@ -42,8 +42,9 @@ public ApiCreateOrUpdateContent() /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. + /// The provisioning state. /// Content value when Importing an API. - /// Format of the Content in which the API is getting imported. + /// Format of the Content in which the API is getting imported. New formats can be added in the future. /// Criteria to limit import of WSDL to a subset of the document. /// /// Type of API to create. @@ -51,8 +52,10 @@ public ApiCreateOrUpdateContent() /// * `soap` creates a SOAP pass-through API /// * `websocket` creates websocket API /// * `graphql` creates GraphQL API. + /// New types can be added in the future. /// - internal ApiCreateOrUpdateContent(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet, string value, ContentFormat? format, ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector, SoapApiType? soapApiType) + /// Strategy of translating required query parameters to template ones. By default has value 'template'. Possible values: 'template', 'query'. + internal ApiCreateOrUpdateParameter(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet, string provisioningState, string value, ContentFormat? format, ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector, SoapApiType? soapApiType, TranslateRequiredQueryParametersConduct? translateRequiredQueryParametersConduct) { Description = description; AuthenticationSettings = authenticationSettings; @@ -75,10 +78,12 @@ internal ApiCreateOrUpdateContent(string description, AuthenticationSettingsCont Path = path; Protocols = protocols; ApiVersionSet = apiVersionSet; + ProvisioningState = provisioningState; Value = value; Format = format; WsdlSelector = wsdlSelector; SoapApiType = soapApiType; + TranslateRequiredQueryParametersConduct = translateRequiredQueryParametersConduct; } /// Description of the API. May include HTML formatting tags. @@ -123,9 +128,11 @@ internal ApiCreateOrUpdateContent(string description, AuthenticationSettingsCont public IList Protocols { get; } /// Version set details. public ApiVersionSetContractDetails ApiVersionSet { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } /// Content value when Importing an API. public string Value { get; set; } - /// Format of the Content in which the API is getting imported. + /// Format of the Content in which the API is getting imported. New formats can be added in the future. public ContentFormat? Format { get; set; } /// Criteria to limit import of WSDL to a subset of the document. public ApiCreateOrUpdatePropertiesWsdlSelector WsdlSelector { get; set; } @@ -135,7 +142,10 @@ internal ApiCreateOrUpdateContent(string description, AuthenticationSettingsCont /// * `soap` creates a SOAP pass-through API /// * `websocket` creates websocket API /// * `graphql` creates GraphQL API. + /// New types can be added in the future. /// public SoapApiType? SoapApiType { get; set; } + /// Strategy of translating required query parameters to template ones. By default has value 'template'. Possible values: 'template', 'query'. + public TranslateRequiredQueryParametersConduct? TranslateRequiredQueryParametersConduct { get; set; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiData.Serialization.cs index 93926ff1915e..fe5ab0f03f59 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiData.Serialization.cs @@ -161,6 +161,7 @@ internal static ApiData DeserializeApiData(JsonElement element) Optional path = default; Optional> protocols = default; Optional apiVersionSet = default; + Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -362,11 +363,16 @@ internal static ApiData DeserializeApiData(JsonElement element) apiVersionSet = ApiVersionSetContractDetails.DeserializeApiVersionSetContractDetails(property0.Value); continue; } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } } continue; } } - return new ApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value); + return new ApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value, provisioningState.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs index 188b67e03386..b576f4891336 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs @@ -95,6 +95,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (Optional.IsDefined(UseInTestConsole)) + { + writer.WritePropertyName("useInTestConsole"u8); + writer.WriteBooleanValue(UseInTestConsole.Value); + } + if (Optional.IsDefined(UseInApiDocumentation)) + { + writer.WritePropertyName("useInApiDocumentation"u8); + writer.WriteBooleanValue(UseInApiDocumentation.Value); + } if (Optional.IsDefined(ClientRegistrationEndpoint)) { writer.WritePropertyName("clientRegistrationEndpoint"u8); @@ -150,6 +160,8 @@ internal static ApiManagementAuthorizationServerData DeserializeApiManagementAut Optional resourceOwnerUsername = default; Optional resourceOwnerPassword = default; Optional displayName = default; + Optional useInTestConsole = default; + Optional useInApiDocumentation = default; Optional clientRegistrationEndpoint = default; Optional authorizationEndpoint = default; Optional> grantTypes = default; @@ -285,6 +297,24 @@ internal static ApiManagementAuthorizationServerData DeserializeApiManagementAut displayName = property0.Value.GetString(); continue; } + if (property0.NameEquals("useInTestConsole"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + useInTestConsole = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("useInApiDocumentation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + useInApiDocumentation = property0.Value.GetBoolean(); + continue; + } if (property0.NameEquals("clientRegistrationEndpoint"u8)) { clientRegistrationEndpoint = property0.Value.GetString(); @@ -323,7 +353,7 @@ internal static ApiManagementAuthorizationServerData DeserializeApiManagementAut continue; } } - return new ApiManagementAuthorizationServerData(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); + return new ApiManagementAuthorizationServerData(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, Optional.ToNullable(useInTestConsole), Optional.ToNullable(useInApiDocumentation), clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs index f6078406a6b8..9789f91ca28e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs @@ -94,6 +94,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (Optional.IsDefined(UseInTestConsole)) + { + writer.WritePropertyName("useInTestConsole"u8); + writer.WriteBooleanValue(UseInTestConsole.Value); + } + if (Optional.IsDefined(UseInApiDocumentation)) + { + writer.WritePropertyName("useInApiDocumentation"u8); + writer.WriteBooleanValue(UseInApiDocumentation.Value); + } if (Optional.IsDefined(ClientRegistrationEndpoint)) { writer.WritePropertyName("clientRegistrationEndpoint"u8); @@ -149,6 +159,8 @@ internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAu Optional resourceOwnerUsername = default; Optional resourceOwnerPassword = default; Optional displayName = default; + Optional useInTestConsole = default; + Optional useInApiDocumentation = default; Optional clientRegistrationEndpoint = default; Optional authorizationEndpoint = default; Optional> grantTypes = default; @@ -284,6 +296,24 @@ internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAu displayName = property0.Value.GetString(); continue; } + if (property0.NameEquals("useInTestConsole"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + useInTestConsole = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("useInApiDocumentation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + useInApiDocumentation = property0.Value.GetBoolean(); + continue; + } if (property0.NameEquals("clientRegistrationEndpoint"u8)) { clientRegistrationEndpoint = property0.Value.GetString(); @@ -322,7 +352,7 @@ internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAu continue; } } - return new ApiManagementAuthorizationServerPatch(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); + return new ApiManagementAuthorizationServerPatch(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, Optional.ToNullable(useInTestConsole), Optional.ToNullable(useInApiDocumentation), clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs index 7a20f453de35..c03b3ba01a0e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs @@ -40,12 +40,14 @@ public ApiManagementAuthorizationServerPatch() /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. /// User-friendly authorization server name. + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. /// Form of an authorization grant, which the client uses to request the access token. /// Client or app id registered with this authorization server. /// Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, bool? useInTestConsole, bool? useInApiDocumentation, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) { Description = description; AuthorizationMethods = authorizationMethods; @@ -58,6 +60,8 @@ internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string nam ResourceOwnerUsername = resourceOwnerUsername; ResourceOwnerPassword = resourceOwnerPassword; DisplayName = displayName; + UseInTestConsole = useInTestConsole; + UseInApiDocumentation = useInApiDocumentation; ClientRegistrationEndpoint = clientRegistrationEndpoint; AuthorizationEndpoint = authorizationEndpoint; GrantTypes = grantTypes; @@ -87,6 +91,10 @@ internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string nam public string ResourceOwnerPassword { get; set; } /// User-friendly authorization server name. public string DisplayName { get; set; } + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + public bool? UseInTestConsole { get; set; } + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. + public bool? UseInApiDocumentation { get; set; } /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. public string ClientRegistrationEndpoint { get; set; } /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs index 05bb1bd6341a..a15bc0902808 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs @@ -55,6 +55,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tls"u8); writer.WriteObjectValue(Tls); } + if (Optional.IsDefined(CircuitBreaker)) + { + writer.WritePropertyName("circuitBreaker"u8); + writer.WriteObjectValue(CircuitBreaker); + } + if (Optional.IsDefined(Pool)) + { + writer.WritePropertyName("pool"u8); + writer.WriteObjectValue(Pool); + } + if (Optional.IsDefined(TypePropertiesType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(TypePropertiesType.Value.ToString()); + } if (Optional.IsDefined(Uri)) { writer.WritePropertyName("url"u8); @@ -86,6 +101,9 @@ internal static ApiManagementBackendData DeserializeApiManagementBackendData(Jso Optional credentials = default; Optional proxy = default; Optional tls = default; + Optional circuitBreaker = default; + Optional pool = default; + Optional type0 = default; Optional uri = default; Optional protocol = default; foreach (var property in element.EnumerateObject()) @@ -178,6 +196,33 @@ internal static ApiManagementBackendData DeserializeApiManagementBackendData(Jso tls = BackendTlsProperties.DeserializeBackendTlsProperties(property0.Value); continue; } + if (property0.NameEquals("circuitBreaker"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + circuitBreaker = BackendCircuitBreaker.DeserializeBackendCircuitBreaker(property0.Value); + continue; + } + if (property0.NameEquals("pool"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pool = BackendBaseParametersPool.DeserializeBackendBaseParametersPool(property0.Value); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type0 = new BackendType(property0.Value.GetString()); + continue; + } if (property0.NameEquals("url"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -200,7 +245,7 @@ internal static ApiManagementBackendData DeserializeApiManagementBackendData(Jso continue; } } - return new ApiManagementBackendData(id, name, type, systemData.Value, title.Value, description.Value, resourceId.Value, properties.Value, credentials.Value, proxy.Value, tls.Value, uri.Value, Optional.ToNullable(protocol)); + return new ApiManagementBackendData(id, name, type, systemData.Value, title.Value, description.Value, resourceId.Value, properties.Value, credentials.Value, proxy.Value, tls.Value, circuitBreaker.Value, pool.Value, Optional.ToNullable(type0), uri.Value, Optional.ToNullable(protocol)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs index 02cf45f10df6..d42342863c6b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs @@ -52,6 +52,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tls"u8); writer.WriteObjectValue(Tls); } + if (Optional.IsDefined(CircuitBreaker)) + { + writer.WritePropertyName("circuitBreaker"u8); + writer.WriteObjectValue(CircuitBreaker); + } + if (Optional.IsDefined(Pool)) + { + writer.WritePropertyName("pool"u8); + writer.WriteObjectValue(Pool); + } + if (Optional.IsDefined(BackendType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(BackendType.Value.ToString()); + } if (Optional.IsDefined(Uri)) { writer.WritePropertyName("url"u8); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs index 3a1e0c96a9d8..0b7f6adc31dd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs @@ -6,6 +6,8 @@ #nullable disable using System; +using System.Collections.Generic; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ApiManagement.Models { @@ -20,14 +22,17 @@ public ApiManagementBackendPatch() /// Initializes a new instance of . /// Backend Title. /// Backend Description. - /// Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. + /// Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. /// Backend Properties contract. /// Backend Credentials Contract Properties. - /// Backend Proxy Contract Properties. + /// Backend gateway Contract Properties. /// Backend TLS Properties. + /// Backend Circuit Breaker Configuration. + /// + /// Type of the backend. A backend can be either Single or Pool. /// Runtime Url of the Backend. /// Backend communication protocol. - internal ApiManagementBackendPatch(string title, string description, Uri resourceUri, BackendProperties properties, BackendCredentialsContract credentials, BackendProxyContract proxy, BackendTlsProperties tls, Uri uri, BackendProtocol? protocol) + internal ApiManagementBackendPatch(string title, string description, Uri resourceUri, BackendProperties properties, BackendCredentialsContract credentials, BackendProxyContract proxy, BackendTlsProperties tls, BackendCircuitBreaker circuitBreaker, BackendBaseParametersPool pool, BackendType? backendType, Uri uri, BackendProtocol? protocol) { Title = title; Description = description; @@ -36,6 +41,9 @@ internal ApiManagementBackendPatch(string title, string description, Uri resourc Credentials = credentials; Proxy = proxy; Tls = tls; + CircuitBreaker = circuitBreaker; + Pool = pool; + BackendType = backendType; Uri = uri; Protocol = protocol; } @@ -44,7 +52,7 @@ internal ApiManagementBackendPatch(string title, string description, Uri resourc public string Title { get; set; } /// Backend Description. public string Description { get; set; } - /// Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. + /// Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. public Uri ResourceUri { get; set; } /// Backend Properties contract. internal BackendProperties Properties { get; set; } @@ -62,10 +70,38 @@ public BackendServiceFabricClusterProperties BackendServiceFabricCluster /// Backend Credentials Contract Properties. public BackendCredentialsContract Credentials { get; set; } - /// Backend Proxy Contract Properties. + /// Backend gateway Contract Properties. public BackendProxyContract Proxy { get; set; } /// Backend TLS Properties. public BackendTlsProperties Tls { get; set; } + /// Backend Circuit Breaker Configuration. + internal BackendCircuitBreaker CircuitBreaker { get; set; } + /// The rules for tripping the backend. + public IList CircuitBreakerRules + { + get + { + if (CircuitBreaker is null) + CircuitBreaker = new BackendCircuitBreaker(); + return CircuitBreaker.Rules; + } + } + + /// Gets or sets the pool. + internal BackendBaseParametersPool Pool { get; set; } + /// The list of backend entities belonging to a pool. + public IList PoolServices + { + get + { + if (Pool is null) + Pool = new BackendBaseParametersPool(); + return Pool.Services; + } + } + + /// Type of the backend. A backend can be either Single or Pool. + public BackendType? BackendType { get; set; } /// Runtime Url of the Backend. public Uri Uri { get; set; } /// Backend communication protocol. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGlobalSchemaData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGlobalSchemaData.Serialization.cs index a91d61dbc1e8..8bedd0024115 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGlobalSchemaData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGlobalSchemaData.Serialization.cs @@ -72,6 +72,7 @@ internal static ApiManagementGlobalSchemaData DeserializeApiManagementGlobalSche Optional description = default; Optional value = default; Optional document = default; + Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -139,11 +140,16 @@ internal static ApiManagementGlobalSchemaData DeserializeApiManagementGlobalSche document = BinaryData.FromString(property0.Value.GetRawText()); continue; } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } } continue; } } - return new ApiManagementGlobalSchemaData(id, name, type, systemData.Value, Optional.ToNullable(schemaType), description.Value, value.Value, document.Value); + return new ApiManagementGlobalSchemaData(id, name, type, systemData.Value, Optional.ToNullable(schemaType), description.Value, value.Value, document.Value, provisioningState.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs index 65b43698e7b1..0f10d047ee1a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs @@ -64,6 +64,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("passwordResetPolicyName"u8); writer.WriteStringValue(PasswordResetPolicyName); } + if (Optional.IsDefined(ClientLibrary)) + { + writer.WritePropertyName("clientLibrary"u8); + writer.WriteStringValue(ClientLibrary); + } if (Optional.IsDefined(ClientId)) { writer.WritePropertyName("clientId"u8); @@ -96,6 +101,7 @@ internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeAp Optional signinPolicyName = default; Optional profileEditingPolicyName = default; Optional passwordResetPolicyName = default; + Optional clientLibrary = default; Optional clientId = default; Optional clientSecret = default; foreach (var property in element.EnumerateObject()) @@ -186,6 +192,11 @@ internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeAp passwordResetPolicyName = property0.Value.GetString(); continue; } + if (property0.NameEquals("clientLibrary"u8)) + { + clientLibrary = property0.Value.GetString(); + continue; + } if (property0.NameEquals("clientId"u8)) { clientId = property0.Value.GetString(); @@ -200,7 +211,7 @@ internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeAp continue; } } - return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientId.Value, clientSecret.Value); + return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientLibrary.Value, clientId.Value, clientSecret.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs index 4aacdea9e1fa..66d699b8594a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs @@ -33,9 +33,10 @@ public ApiManagementIdentityProviderCreateOrUpdateContent() /// Signin Policy Name. Only applies to AAD B2C Identity Provider. /// Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientLibrary, string clientId, string clientSecret) : base(id, name, resourceType, systemData) { IdentityProviderType = identityProviderType; SignInTenant = signInTenant; @@ -45,6 +46,7 @@ internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier i SignInPolicyName = signInPolicyName; ProfileEditingPolicyName = profileEditingPolicyName; PasswordResetPolicyName = passwordResetPolicyName; + ClientLibrary = clientLibrary; ClientId = clientId; ClientSecret = clientSecret; } @@ -65,6 +67,8 @@ internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier i public string ProfileEditingPolicyName { get; set; } /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. public string PasswordResetPolicyName { get; set; } + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + public string ClientLibrary { get; set; } /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. public string ClientId { get; set; } /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs index 77624f0e7b02..a22a68181e72 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs @@ -65,6 +65,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("passwordResetPolicyName"u8); writer.WriteStringValue(PasswordResetPolicyName); } + if (Optional.IsDefined(ClientLibrary)) + { + writer.WritePropertyName("clientLibrary"u8); + writer.WriteStringValue(ClientLibrary); + } if (Optional.IsDefined(ClientId)) { writer.WritePropertyName("clientId"u8); @@ -97,6 +102,7 @@ internal static ApiManagementIdentityProviderData DeserializeApiManagementIdenti Optional signinPolicyName = default; Optional profileEditingPolicyName = default; Optional passwordResetPolicyName = default; + Optional clientLibrary = default; Optional clientId = default; Optional clientSecret = default; foreach (var property in element.EnumerateObject()) @@ -187,6 +193,11 @@ internal static ApiManagementIdentityProviderData DeserializeApiManagementIdenti passwordResetPolicyName = property0.Value.GetString(); continue; } + if (property0.NameEquals("clientLibrary"u8)) + { + clientLibrary = property0.Value.GetString(); + continue; + } if (property0.NameEquals("clientId"u8)) { clientId = property0.Value.GetString(); @@ -201,7 +212,7 @@ internal static ApiManagementIdentityProviderData DeserializeApiManagementIdenti continue; } } - return new ApiManagementIdentityProviderData(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientId.Value, clientSecret.Value); + return new ApiManagementIdentityProviderData(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientLibrary.Value, clientId.Value, clientSecret.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs index 0fd832756a99..eab20f3412cb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs @@ -62,6 +62,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("passwordResetPolicyName"u8); writer.WriteStringValue(PasswordResetPolicyName); } + if (Optional.IsDefined(ClientLibrary)) + { + writer.WritePropertyName("clientLibrary"u8); + writer.WriteStringValue(ClientLibrary); + } if (Optional.IsDefined(ClientId)) { writer.WritePropertyName("clientId"u8); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs index 6c9184b2faca..65637c513212 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs @@ -28,9 +28,10 @@ public ApiManagementIdentityProviderPatch() /// Signin Policy Name. Only applies to AAD B2C Identity Provider. /// Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. - internal ApiManagementIdentityProviderPatch(IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret) + internal ApiManagementIdentityProviderPatch(IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientLibrary, string clientId, string clientSecret) { IdentityProviderType = identityProviderType; SignInTenant = signInTenant; @@ -40,6 +41,7 @@ internal ApiManagementIdentityProviderPatch(IdentityProviderType? identityProvid SignInPolicyName = signInPolicyName; ProfileEditingPolicyName = profileEditingPolicyName; PasswordResetPolicyName = passwordResetPolicyName; + ClientLibrary = clientLibrary; ClientId = clientId; ClientSecret = clientSecret; } @@ -60,6 +62,8 @@ internal ApiManagementIdentityProviderPatch(IdentityProviderType? identityProvid public string ProfileEditingPolicyName { get; set; } /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. public string PasswordResetPolicyName { get; set; } + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + public string ClientLibrary { get; set; } /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. public string ClientId { get; set; } /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueData.Serialization.cs index 9fd7092f881b..5b6607f80f5b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueData.Serialization.cs @@ -69,6 +69,7 @@ internal static ApiManagementNamedValueData DeserializeApiManagementNamedValueDa Optional displayName = default; Optional value = default; Optional keyVault = default; + Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -146,11 +147,16 @@ internal static ApiManagementNamedValueData DeserializeApiManagementNamedValueDa keyVault = KeyVaultContractProperties.DeserializeKeyVaultContractProperties(property0.Value); continue; } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } } continue; } } - return new ApiManagementNamedValueData(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value); + return new ApiManagementNamedValueData(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value, provisioningState.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs index 734443ef809d..110435f3618d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs @@ -43,6 +43,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientSecret"u8); writer.WriteStringValue(ClientSecret); } + if (Optional.IsDefined(UseInTestConsole)) + { + writer.WritePropertyName("useInTestConsole"u8); + writer.WriteBooleanValue(UseInTestConsole.Value); + } + if (Optional.IsDefined(UseInApiDocumentation)) + { + writer.WritePropertyName("useInApiDocumentation"u8); + writer.WriteBooleanValue(UseInApiDocumentation.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -62,6 +72,8 @@ internal static ApiManagementOpenIdConnectProviderData DeserializeApiManagementO Optional metadataEndpoint = default; Optional clientId = default; Optional clientSecret = default; + Optional useInTestConsole = default; + Optional useInApiDocumentation = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -122,11 +134,29 @@ internal static ApiManagementOpenIdConnectProviderData DeserializeApiManagementO clientSecret = property0.Value.GetString(); continue; } + if (property0.NameEquals("useInTestConsole"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + useInTestConsole = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("useInApiDocumentation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + useInApiDocumentation = property0.Value.GetBoolean(); + continue; + } } continue; } } - return new ApiManagementOpenIdConnectProviderData(id, name, type, systemData.Value, displayName.Value, description.Value, metadataEndpoint.Value, clientId.Value, clientSecret.Value); + return new ApiManagementOpenIdConnectProviderData(id, name, type, systemData.Value, displayName.Value, description.Value, metadataEndpoint.Value, clientId.Value, clientSecret.Value, Optional.ToNullable(useInTestConsole), Optional.ToNullable(useInApiDocumentation)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs index e8f0b52e9273..c0a2fc201b65 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs @@ -42,6 +42,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientSecret"u8); writer.WriteStringValue(ClientSecret); } + if (Optional.IsDefined(UseInTestConsole)) + { + writer.WritePropertyName("useInTestConsole"u8); + writer.WriteBooleanValue(UseInTestConsole.Value); + } + if (Optional.IsDefined(UseInApiDocumentation)) + { + writer.WritePropertyName("useInApiDocumentation"u8); + writer.WriteBooleanValue(UseInApiDocumentation.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs index 8d938ec0da11..64fca53d031e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs @@ -21,13 +21,17 @@ public ApiManagementOpenIdConnectProviderPatch() /// Metadata endpoint URI. /// Client ID of developer console which is the client application. /// Client Secret of developer console which is the client application. - internal ApiManagementOpenIdConnectProviderPatch(string displayName, string description, string metadataEndpoint, string clientId, string clientSecret) + /// If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided. + /// If true, the Open ID Connect provider will be used in the API documentation in the developer portal. False by default if no value is provided. + internal ApiManagementOpenIdConnectProviderPatch(string displayName, string description, string metadataEndpoint, string clientId, string clientSecret, bool? useInTestConsole, bool? useInApiDocumentation) { DisplayName = displayName; Description = description; MetadataEndpoint = metadataEndpoint; ClientId = clientId; ClientSecret = clientSecret; + UseInTestConsole = useInTestConsole; + UseInApiDocumentation = useInApiDocumentation; } /// User-friendly OpenID Connect Provider name. @@ -40,5 +44,9 @@ internal ApiManagementOpenIdConnectProviderPatch(string displayName, string desc public string ClientId { get; set; } /// Client Secret of developer console which is the client application. public string ClientSecret { get; set; } + /// If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided. + public bool? UseInTestConsole { get; set; } + /// If true, the Open ID Connect provider will be used in the API documentation in the developer portal. False by default if no value is provided. + public bool? UseInApiDocumentation { get; set; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalRevisionData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalRevisionData.Serialization.cs index 408eae306bfd..5ce1b4b15916 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalRevisionData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalRevisionData.Serialization.cs @@ -50,6 +50,7 @@ internal static ApiManagementPortalRevisionData DeserializeApiManagementPortalRe Optional isCurrent = default; Optional createdDateTime = default; Optional updatedDateTime = default; + Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -131,11 +132,16 @@ internal static ApiManagementPortalRevisionData DeserializeApiManagementPortalRe updatedDateTime = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } } continue; } } - return new ApiManagementPortalRevisionData(id, name, type, systemData.Value, description.Value, statusDetails.Value, Optional.ToNullable(status), Optional.ToNullable(isCurrent), Optional.ToNullable(createdDateTime), Optional.ToNullable(updatedDateTime)); + return new ApiManagementPortalRevisionData(id, name, type, systemData.Value, description.Value, statusDetails.Value, Optional.ToNullable(status), Optional.ToNullable(isCurrent), Optional.ToNullable(createdDateTime), Optional.ToNullable(updatedDateTime), provisioningState.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs index 1f3032901570..e588f9acf5e6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs @@ -78,6 +78,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publicNetworkAccess"u8); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (Optional.IsDefined(ConfigurationApi)) + { + writer.WritePropertyName("configurationApi"u8); + writer.WriteObjectValue(ConfigurationApi); + } if (Optional.IsDefined(VirtualNetworkConfiguration)) { writer.WritePropertyName("virtualNetworkConfiguration"u8); @@ -119,6 +124,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableClientCertificate"u8); writer.WriteBooleanValue(EnableClientCertificate.Value); } + if (Optional.IsDefined(NatGatewayState)) + { + writer.WritePropertyName("natGatewayState"u8); + writer.WriteStringValue(NatGatewayState.Value.ToString()); + } if (Optional.IsDefined(DisableGateway)) { writer.WritePropertyName("disableGateway"u8); @@ -149,6 +159,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(LegacyPortalStatus)) + { + writer.WritePropertyName("legacyPortalStatus"u8); + writer.WriteStringValue(LegacyPortalStatus.Value.ToString()); + } + if (Optional.IsDefined(DeveloperPortalStatus)) + { + writer.WritePropertyName("developerPortalStatus"u8); + writer.WriteStringValue(DeveloperPortalStatus.Value.ToString()); + } writer.WritePropertyName("publisherEmail"u8); writer.WriteStringValue(PublisherEmail); writer.WritePropertyName("publisherName"u8); @@ -188,17 +208,22 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso Optional> privateIPAddresses = default; Optional publicIPAddressId = default; Optional publicNetworkAccess = default; + Optional configurationApi = default; Optional virtualNetworkConfiguration = default; Optional> additionalLocations = default; Optional> customProperties = default; Optional> certificates = default; Optional enableClientCertificate = default; + Optional natGatewayState = default; + Optional> outboundPublicIPAddresses = default; Optional disableGateway = default; Optional virtualNetworkType = default; Optional apiVersionConstraint = default; Optional restore = default; Optional> privateEndpointConnections = default; Optional platformVersion = default; + Optional legacyPortalStatus = default; + Optional developerPortalStatus = default; string publisherEmail = default; string publisherName = default; foreach (var property in element.EnumerateObject()) @@ -444,6 +469,15 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } + if (property0.NameEquals("configurationApi"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configurationApi = ConfigurationApi.DeserializeConfigurationApi(property0.Value); + continue; + } if (property0.NameEquals("virtualNetworkConfiguration"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -504,6 +538,29 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso enableClientCertificate = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("natGatewayState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + natGatewayState = new NatGatewayState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("outboundPublicIPAddresses"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + outboundPublicIPAddresses = array; + continue; + } if (property0.NameEquals("disableGateway"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -563,6 +620,24 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso platformVersion = new PlatformVersion(property0.Value.GetString()); continue; } + if (property0.NameEquals("legacyPortalStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + legacyPortalStatus = new LegacyPortalStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("developerPortalStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + developerPortalStatus = new DeveloperPortalStatus(property0.Value.GetString()); + continue; + } if (property0.NameEquals("publisherEmail"u8)) { publisherEmail = property0.Value.GetString(); @@ -577,7 +652,7 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso continue; } } - return new ApiManagementServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail, publisherName); + return new ApiManagementServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), configurationApi.Value, virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(natGatewayState), Optional.ToList(outboundPublicIPAddresses), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), Optional.ToNullable(legacyPortalStatus), Optional.ToNullable(developerPortalStatus), publisherEmail, publisherName); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs index 077243d42922..7f370348f520 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs @@ -78,6 +78,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publicNetworkAccess"u8); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (Optional.IsDefined(ConfigurationApi)) + { + writer.WritePropertyName("configurationApi"u8); + writer.WriteObjectValue(ConfigurationApi); + } if (Optional.IsDefined(VirtualNetworkConfiguration)) { writer.WritePropertyName("virtualNetworkConfiguration"u8); @@ -119,6 +124,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableClientCertificate"u8); writer.WriteBooleanValue(EnableClientCertificate.Value); } + if (Optional.IsDefined(NatGatewayState)) + { + writer.WritePropertyName("natGatewayState"u8); + writer.WriteStringValue(NatGatewayState.Value.ToString()); + } if (Optional.IsDefined(DisableGateway)) { writer.WritePropertyName("disableGateway"u8); @@ -149,6 +159,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(LegacyPortalStatus)) + { + writer.WritePropertyName("legacyPortalStatus"u8); + writer.WriteStringValue(LegacyPortalStatus.Value.ToString()); + } + if (Optional.IsDefined(DeveloperPortalStatus)) + { + writer.WritePropertyName("developerPortalStatus"u8); + writer.WriteStringValue(DeveloperPortalStatus.Value.ToString()); + } if (Optional.IsDefined(PublisherEmail)) { writer.WritePropertyName("publisherEmail"u8); @@ -193,17 +213,22 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J Optional> privateIPAddresses = default; Optional publicIPAddressId = default; Optional publicNetworkAccess = default; + Optional configurationApi = default; Optional virtualNetworkConfiguration = default; Optional> additionalLocations = default; Optional> customProperties = default; Optional> certificates = default; Optional enableClientCertificate = default; + Optional natGatewayState = default; + Optional> outboundPublicIPAddresses = default; Optional disableGateway = default; Optional virtualNetworkType = default; Optional apiVersionConstraint = default; Optional restore = default; Optional> privateEndpointConnections = default; Optional platformVersion = default; + Optional legacyPortalStatus = default; + Optional developerPortalStatus = default; Optional publisherEmail = default; Optional publisherName = default; foreach (var property in element.EnumerateObject()) @@ -448,6 +473,15 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } + if (property0.NameEquals("configurationApi"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configurationApi = ConfigurationApi.DeserializeConfigurationApi(property0.Value); + continue; + } if (property0.NameEquals("virtualNetworkConfiguration"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -508,6 +542,29 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J enableClientCertificate = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("natGatewayState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + natGatewayState = new NatGatewayState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("outboundPublicIPAddresses"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + outboundPublicIPAddresses = array; + continue; + } if (property0.NameEquals("disableGateway"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -567,6 +624,24 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J platformVersion = new PlatformVersion(property0.Value.GetString()); continue; } + if (property0.NameEquals("legacyPortalStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + legacyPortalStatus = new LegacyPortalStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("developerPortalStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + developerPortalStatus = new DeveloperPortalStatus(property0.Value.GetString()); + continue; + } if (property0.NameEquals("publisherEmail"u8)) { publisherEmail = property0.Value.GetString(); @@ -581,7 +656,7 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J continue; } } - return new ApiManagementServicePatch(id, name, type, systemData.Value, sku.Value, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail.Value, publisherName.Value, Optional.ToDictionary(tags)); + return new ApiManagementServicePatch(id, name, type, systemData.Value, sku.Value, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), configurationApi.Value, virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(natGatewayState), Optional.ToList(outboundPublicIPAddresses), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), Optional.ToNullable(legacyPortalStatus), Optional.ToNullable(developerPortalStatus), publisherEmail.Value, publisherName.Value, Optional.ToDictionary(tags)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs index 78dddbb68dda..b04f7ca9eca4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs @@ -27,6 +27,7 @@ public ApiManagementServicePatch() AdditionalLocations = new ChangeTrackingList(); CustomProperties = new ChangeTrackingDictionary(); Certificates = new ChangeTrackingList(); + OutboundPublicIPAddresses = new ChangeTrackingList(); PrivateEndpointConnections = new ChangeTrackingList(); Tags = new ChangeTrackingDictionary(); } @@ -55,21 +56,26 @@ public ApiManagementServicePatch() /// Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. /// Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network. /// Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + /// Configuration API configuration of the API Management service. /// Virtual network configuration of the API Management service. /// Additional datacenter locations of the API Management service. - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + /// Property can be used to enable NAT Gateway for this API Management service. + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. /// Control Plane Apis version constraint for the API Management service. /// Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. /// List of Private Endpoint Connections of this service. /// Compute Platform Version running the service in this location. + /// Status of legacy portal in the API Management service. + /// Status of developer portal in this API Management service. /// Publisher email. /// Publisher name. /// Resource tags. - internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName, IDictionary tags) : base(id, name, resourceType, systemData) + internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, ConfigurationApi configurationApi, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, NatGatewayState? natGatewayState, IReadOnlyList outboundPublicIPAddresses, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, LegacyPortalStatus? legacyPortalStatus, DeveloperPortalStatus? developerPortalStatus, string publisherEmail, string publisherName, IDictionary tags) : base(id, name, resourceType, systemData) { Sku = sku; Identity = identity; @@ -90,17 +96,22 @@ internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceT PrivateIPAddresses = privateIPAddresses; PublicIPAddressId = publicIPAddressId; PublicNetworkAccess = publicNetworkAccess; + ConfigurationApi = configurationApi; VirtualNetworkConfiguration = virtualNetworkConfiguration; AdditionalLocations = additionalLocations; CustomProperties = customProperties; Certificates = certificates; EnableClientCertificate = enableClientCertificate; + NatGatewayState = natGatewayState; + OutboundPublicIPAddresses = outboundPublicIPAddresses; DisableGateway = disableGateway; VirtualNetworkType = virtualNetworkType; ApiVersionConstraint = apiVersionConstraint; Restore = restore; PrivateEndpointConnections = privateEndpointConnections; PlatformVersion = platformVersion; + LegacyPortalStatus = legacyPortalStatus; + DeveloperPortalStatus = developerPortalStatus; PublisherEmail = publisherEmail; PublisherName = publisherName; Tags = tags; @@ -144,16 +155,34 @@ internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceT public ResourceIdentifier PublicIPAddressId { get; set; } /// Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. public PublicNetworkAccess? PublicNetworkAccess { get; set; } + /// Configuration API configuration of the API Management service. + internal ConfigurationApi ConfigurationApi { get; set; } + /// Indication whether or not the legacy Configuration API (v1) should be exposed on the API Management service. Value is optional but must be 'Enabled' or 'Disabled'. If 'Disabled', legacy Configuration API (v1) will not be available for self-hosted gateways. Default value is 'Enabled'. + public LegacyApiState? LegacyApi + { + get => ConfigurationApi is null ? default : ConfigurationApi.LegacyApi; + set + { + if (ConfigurationApi is null) + ConfigurationApi = new ConfigurationApi(); + ConfigurationApi.LegacyApi = value; + } + } + /// Virtual network configuration of the API Management service. public VirtualNetworkConfiguration VirtualNetworkConfiguration { get; set; } /// Additional datacenter locations of the API Management service. public IList AdditionalLocations { get; } - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. public IDictionary CustomProperties { get; } /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. public IList Certificates { get; } /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. public bool? EnableClientCertificate { get; set; } + /// Property can be used to enable NAT Gateway for this API Management service. + public NatGatewayState? NatGatewayState { get; set; } + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. + public IReadOnlyList OutboundPublicIPAddresses { get; } /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. public bool? DisableGateway { get; set; } /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. @@ -178,6 +207,10 @@ public string MinApiVersion public IList PrivateEndpointConnections { get; } /// Compute Platform Version running the service in this location. public PlatformVersion? PlatformVersion { get; } + /// Status of legacy portal in the API Management service. + public LegacyPortalStatus? LegacyPortalStatus { get; set; } + /// Status of developer portal in this API Management service. + public DeveloperPortalStatus? DeveloperPortalStatus { get; set; } /// Publisher email. public string PublisherEmail { get; set; } /// Publisher name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuType.cs index d73c6f372a33..84cabc0c6bae 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuType.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuType.cs @@ -28,6 +28,8 @@ public ApiManagementServiceSkuType(string value) private const string BasicValue = "Basic"; private const string ConsumptionValue = "Consumption"; private const string IsolatedValue = "Isolated"; + private const string BasicV2Value = "BasicV2"; + private const string StandardV2Value = "StandardV2"; /// Developer SKU of Api Management. public static ApiManagementServiceSkuType Developer { get; } = new ApiManagementServiceSkuType(DeveloperValue); @@ -41,6 +43,10 @@ public ApiManagementServiceSkuType(string value) public static ApiManagementServiceSkuType Consumption { get; } = new ApiManagementServiceSkuType(ConsumptionValue); /// Isolated SKU of Api Management. public static ApiManagementServiceSkuType Isolated { get; } = new ApiManagementServiceSkuType(IsolatedValue); + /// BasicV2 SKU of Api Management. + public static ApiManagementServiceSkuType BasicV2 { get; } = new ApiManagementServiceSkuType(BasicV2Value); + /// StandardV2 SKU of Api Management. + public static ApiManagementServiceSkuType StandardV2 { get; } = new ApiManagementServiceSkuType(StandardV2Value); /// Determines if two values are the same. public static bool operator ==(ApiManagementServiceSkuType left, ApiManagementServiceSkuType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaData.Serialization.cs index cf34ba8ff1e3..57511e66aa5e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaData.Serialization.cs @@ -71,6 +71,7 @@ internal static ApiSchemaData DeserializeApiSchemaData(JsonElement element) ResourceType type = default; Optional systemData = default; Optional contentType = default; + Optional provisioningState = default; Optional value = default; Optional definitions = default; Optional components = default; @@ -114,6 +115,11 @@ internal static ApiSchemaData DeserializeApiSchemaData(JsonElement element) contentType = property0.Value.GetString(); continue; } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } if (property0.NameEquals("document"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -153,7 +159,7 @@ internal static ApiSchemaData DeserializeApiSchemaData(JsonElement element) continue; } } - return new ApiSchemaData(id, name, type, systemData.Value, contentType.Value, value.Value, definitions.Value, components.Value); + return new ApiSchemaData(id, name, type, systemData.Value, contentType.Value, provisioningState.Value, value.Value, definitions.Value, components.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaType.cs index e9684357728c..63c5b3fec82e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaType.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaType.cs @@ -25,7 +25,7 @@ public ApiSchemaType(string value) private const string XmlValue = "xml"; private const string JsonValue = "json"; - /// Xml schema type. + /// XML schema type. public static ApiSchemaType Xml { get; } = new ApiSchemaType(XmlValue); /// Json schema type. public static ApiSchemaType Json { get; } = new ApiSchemaType(JsonValue); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiType.cs index ca1b858df8e7..d22f23fa3b21 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiType.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiType.cs @@ -26,6 +26,8 @@ public ApiType(string value) private const string SoapValue = "soap"; private const string WebSocketValue = "websocket"; private const string GraphQLValue = "graphql"; + private const string OdataValue = "odata"; + private const string GrpcValue = "grpc"; /// http. public static ApiType Http { get; } = new ApiType(HttpValue); @@ -35,6 +37,10 @@ public ApiType(string value) public static ApiType WebSocket { get; } = new ApiType(WebSocketValue); /// graphql. public static ApiType GraphQL { get; } = new ApiType(GraphQLValue); + /// odata. + public static ApiType Odata { get; } = new ApiType(OdataValue); + /// grpc. + public static ApiType Grpc { get; } = new ApiType(GrpcValue); /// Determines if two values are the same. public static bool operator ==(ApiType left, ApiType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.Serialization.cs similarity index 98% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.Serialization.cs index 9657935cef5c..ad4ec06c2498 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiPatch : IUtf8JsonSerializable + public partial class ApiUpdateContract : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.cs similarity index 89% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.cs index 21d85aecf6ab..cd4f3f01fe14 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.cs @@ -12,15 +12,15 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// API update contract details. - public partial class ApiPatch + public partial class ApiUpdateContract { - /// Initializes a new instance of . - public ApiPatch() + /// Initializes a new instance of . + public ApiUpdateContract() { Protocols = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Description of the API. May include HTML formatting tags. /// Collection of authentication settings included into this API. /// Protocols over which API is made available. @@ -40,7 +40,7 @@ public ApiPatch() /// Absolute URL of the backend service implementing this API. /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. - internal ApiPatch(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, string displayName, Uri serviceUri, string path, IList protocols) + internal ApiUpdateContract(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, string displayName, Uri serviceUri, string path, IList protocols) { Description = description; AuthenticationSettings = authenticationSettings; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.Serialization.cs similarity index 95% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.Serialization.cs index b2d763268872..fae512f99577 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiVersionSetPatch : IUtf8JsonSerializable + public partial class ApiVersionSetUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs similarity index 85% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs index c6fa4719db2c..788049439148 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs @@ -8,20 +8,20 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters to update or create an API Version Set Contract. - public partial class ApiVersionSetPatch + public partial class ApiVersionSetUpdateParameters { - /// Initializes a new instance of . - public ApiVersionSetPatch() + /// Initializes a new instance of . + public ApiVersionSetUpdateParameters() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Description of API Version Set. /// Name of query parameter that indicates the API Version if versioningScheme is set to `query`. /// Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. /// Name of API Version Set. /// An value that determines where the API Version identifier will be located in a HTTP request. - internal ApiVersionSetPatch(string description, string versionQueryName, string versionHeaderName, string displayName, VersioningScheme? versioningScheme) + internal ApiVersionSetUpdateParameters(string description, string versionQueryName, string versionHeaderName, string displayName, VersioningScheme? versioningScheme) { Description = description; VersionQueryName = versionQueryName; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs index 983e32045d96..8dde76bcb330 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -25,6 +26,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("openid"u8); writer.WriteObjectValue(OpenId); } + if (Optional.IsCollectionDefined(OAuth2AuthenticationSettings)) + { + writer.WritePropertyName("oAuth2AuthenticationSettings"u8); + writer.WriteStartArray(); + foreach (var item in OAuth2AuthenticationSettings) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(OpenidAuthenticationSettings)) + { + writer.WritePropertyName("openidAuthenticationSettings"u8); + writer.WriteStartArray(); + foreach (var item in OpenidAuthenticationSettings) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } writer.WriteEndObject(); } @@ -36,6 +57,8 @@ internal static AuthenticationSettingsContract DeserializeAuthenticationSettings } Optional oAuth2 = default; Optional openid = default; + Optional> oAuth2AuthenticationSettings = default; + Optional> openidAuthenticationSettings = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("oAuth2"u8)) @@ -56,8 +79,36 @@ internal static AuthenticationSettingsContract DeserializeAuthenticationSettings openid = OpenIdAuthenticationSettingsContract.DeserializeOpenIdAuthenticationSettingsContract(property.Value); continue; } + if (property.NameEquals("oAuth2AuthenticationSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OAuth2AuthenticationSettingsContract.DeserializeOAuth2AuthenticationSettingsContract(item)); + } + oAuth2AuthenticationSettings = array; + continue; + } + if (property.NameEquals("openidAuthenticationSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OpenIdAuthenticationSettingsContract.DeserializeOpenIdAuthenticationSettingsContract(item)); + } + openidAuthenticationSettings = array; + continue; + } } - return new AuthenticationSettingsContract(oAuth2.Value, openid.Value); + return new AuthenticationSettingsContract(oAuth2.Value, openid.Value, Optional.ToList(oAuth2AuthenticationSettings), Optional.ToList(openidAuthenticationSettings)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs index d1114194b257..fb0cbcb74401 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs @@ -5,6 +5,9 @@ #nullable disable +using System.Collections.Generic; +using Azure.Core; + namespace Azure.ResourceManager.ApiManagement.Models { /// API Authentication Settings. @@ -13,20 +16,30 @@ public partial class AuthenticationSettingsContract /// Initializes a new instance of . public AuthenticationSettingsContract() { + OAuth2AuthenticationSettings = new ChangeTrackingList(); + OpenidAuthenticationSettings = new ChangeTrackingList(); } /// Initializes a new instance of . /// OAuth2 Authentication settings. /// OpenID Connect Authentication Settings. - internal AuthenticationSettingsContract(OAuth2AuthenticationSettingsContract oAuth2, OpenIdAuthenticationSettingsContract openId) + /// Collection of OAuth2 authentication settings included into this API. + /// Collection of Open ID Connect authentication settings included into this API. + internal AuthenticationSettingsContract(OAuth2AuthenticationSettingsContract oAuth2, OpenIdAuthenticationSettingsContract openId, IList oAuth2AuthenticationSettings, IList openidAuthenticationSettings) { OAuth2 = oAuth2; OpenId = openId; + OAuth2AuthenticationSettings = oAuth2AuthenticationSettings; + OpenidAuthenticationSettings = openidAuthenticationSettings; } /// OAuth2 Authentication settings. public OAuth2AuthenticationSettingsContract OAuth2 { get; set; } /// OpenID Connect Authentication Settings. public OpenIdAuthenticationSettingsContract OpenId { get; set; } + /// Collection of OAuth2 authentication settings included into this API. + public IList OAuth2AuthenticationSettings { get; } + /// Collection of Open ID Connect authentication settings included into this API. + public IList OpenidAuthenticationSettings { get; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyContractData.Serialization.cs new file mode 100644 index 000000000000..1f1aa021b5e2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyContractData.Serialization.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class AuthorizationAccessPolicyContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AppIds)) + { + writer.WritePropertyName("appIds"u8); + writer.WriteStartArray(); + foreach (var item in AppIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId.Value); + } + if (Optional.IsDefined(ObjectId)) + { + writer.WritePropertyName("objectId"u8); + writer.WriteStringValue(ObjectId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AuthorizationAccessPolicyContractData DeserializeAuthorizationAccessPolicyContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional> appIds = default; + Optional tenantId = default; + Optional objectId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("appIds"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + appIds = array; + continue; + } + if (property0.NameEquals("tenantId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("objectId"u8)) + { + objectId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new AuthorizationAccessPolicyContractData(id, name, type, systemData.Value, Optional.ToList(appIds), Optional.ToNullable(tenantId), objectId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.Serialization.cs new file mode 100644 index 000000000000..d8b9cd333434 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class AuthorizationAccessPolicyListResult + { + internal static AuthorizationAccessPolicyListResult DeserializeAuthorizationAccessPolicyListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new AuthorizationAccessPolicyListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.cs new file mode 100644 index 000000000000..fb54d6e97ae2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Authorization Access Policy list representation. + internal partial class AuthorizationAccessPolicyListResult + { + /// Initializes a new instance of . + internal AuthorizationAccessPolicyListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal AuthorizationAccessPolicyListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.Serialization.cs new file mode 100644 index 000000000000..e1382e160b09 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationConfirmConsentCodeRequestContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ConsentCode)) + { + writer.WritePropertyName("consentCode"u8); + writer.WriteStringValue(ConsentCode); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.cs new file mode 100644 index 000000000000..3fc3741ea163 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization confirm consent code request contract. + public partial class AuthorizationConfirmConsentCodeRequestContract + { + /// Initializes a new instance of . + public AuthorizationConfirmConsentCodeRequestContract() + { + } + + /// Initializes a new instance of . + /// The consent code from the authorization server after authorizing and consenting. + internal AuthorizationConfirmConsentCodeRequestContract(string consentCode) + { + ConsentCode = consentCode; + } + + /// The consent code from the authorization server after authorizing and consenting. + public string ConsentCode { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationContractData.Serialization.cs new file mode 100644 index 000000000000..e09e0da2ba34 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationContractData.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class AuthorizationContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(AuthorizationType)) + { + writer.WritePropertyName("authorizationType"u8); + writer.WriteStringValue(AuthorizationType.Value.ToString()); + } + if (Optional.IsDefined(OAuth2GrantType)) + { + writer.WritePropertyName("oauth2grantType"u8); + writer.WriteStringValue(OAuth2GrantType.Value.ToString()); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AuthorizationContractData DeserializeAuthorizationContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional authorizationType = default; + Optional oauth2grantType = default; + Optional> parameters = default; + Optional error = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("authorizationType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authorizationType = new AuthorizationType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("oauth2grantType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + oauth2grantType = new OAuth2GrantType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("error"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = AuthorizationError.DeserializeAuthorizationError(property0.Value); + continue; + } + if (property0.NameEquals("status"u8)) + { + status = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new AuthorizationContractData(id, name, type, systemData.Value, Optional.ToNullable(authorizationType), Optional.ToNullable(oauth2grantType), Optional.ToDictionary(parameters), error.Value, status.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.Serialization.cs new file mode 100644 index 000000000000..288ab2e5f0b7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationError : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + writer.WriteEndObject(); + } + + internal static AuthorizationError DeserializeAuthorizationError(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional code = default; + Optional message = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + } + return new AuthorizationError(code.Value, message.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.cs new file mode 100644 index 000000000000..ee8cc9647848 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization error details. + public partial class AuthorizationError + { + /// Initializes a new instance of . + public AuthorizationError() + { + } + + /// Initializes a new instance of . + /// Error code. + /// Error message. + internal AuthorizationError(string code, string message) + { + Code = code; + Message = message; + } + + /// Error code. + public string Code { get; set; } + /// Error message. + public string Message { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.Serialization.cs new file mode 100644 index 000000000000..eb307d06327b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class AuthorizationListResult + { + internal static AuthorizationListResult DeserializeAuthorizationListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuthorizationContractData.DeserializeAuthorizationContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new AuthorizationListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.cs new file mode 100644 index 000000000000..0a1b46042809 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Authorization list representation. + internal partial class AuthorizationListResult + { + /// Initializes a new instance of . + internal AuthorizationListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal AuthorizationListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.Serialization.cs new file mode 100644 index 000000000000..6e3fab6ca804 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationLoginRequestContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PostLoginRedirectUri)) + { + writer.WritePropertyName("postLoginRedirectUrl"u8); + writer.WriteStringValue(PostLoginRedirectUri.AbsoluteUri); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.cs new file mode 100644 index 000000000000..8873e4e5c7b4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization login request contract. + public partial class AuthorizationLoginRequestContract + { + /// Initializes a new instance of . + public AuthorizationLoginRequestContract() + { + } + + /// Initializes a new instance of . + /// The redirect URL after login has completed. + internal AuthorizationLoginRequestContract(Uri postLoginRedirectUri) + { + PostLoginRedirectUri = postLoginRedirectUri; + } + + /// The redirect URL after login has completed. + public Uri PostLoginRedirectUri { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.Serialization.cs new file mode 100644 index 000000000000..893542009f58 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationLoginResponseContract + { + internal static AuthorizationLoginResponseContract DeserializeAuthorizationLoginResponseContract(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional loginLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loginLink"u8)) + { + loginLink = property.Value.GetString(); + continue; + } + } + return new AuthorizationLoginResponseContract(loginLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.cs new file mode 100644 index 000000000000..14cc31f0dc3a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization login response contract. + public partial class AuthorizationLoginResponseContract + { + /// Initializes a new instance of . + internal AuthorizationLoginResponseContract() + { + } + + /// Initializes a new instance of . + /// The login link. + internal AuthorizationLoginResponseContract(string loginLink) + { + LoginLink = loginLink; + } + + /// The login link. + public string LoginLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderContractData.Serialization.cs new file mode 100644 index 000000000000..b2fb7fcc7ec1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderContractData.Serialization.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class AuthorizationProviderContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(IdentityProvider)) + { + writer.WritePropertyName("identityProvider"u8); + writer.WriteStringValue(IdentityProvider); + } + if (Optional.IsDefined(Oauth2)) + { + writer.WritePropertyName("oauth2"u8); + writer.WriteObjectValue(Oauth2); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AuthorizationProviderContractData DeserializeAuthorizationProviderContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional displayName = default; + Optional identityProvider = default; + Optional oauth2 = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("identityProvider"u8)) + { + identityProvider = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("oauth2"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + oauth2 = AuthorizationProviderOAuth2Settings.DeserializeAuthorizationProviderOAuth2Settings(property0.Value); + continue; + } + } + continue; + } + } + return new AuthorizationProviderContractData(id, name, type, systemData.Value, displayName.Value, identityProvider.Value, oauth2.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.Serialization.cs new file mode 100644 index 000000000000..5e8de1c3a1e8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class AuthorizationProviderListResult + { + internal static AuthorizationProviderListResult DeserializeAuthorizationProviderListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new AuthorizationProviderListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.cs new file mode 100644 index 000000000000..52278008cc9c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Authorization Provider list representation. + internal partial class AuthorizationProviderListResult + { + /// Initializes a new instance of . + internal AuthorizationProviderListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Next page link if any. + internal AuthorizationProviderListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.Serialization.cs new file mode 100644 index 000000000000..f65ce7835db6 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.Serialization.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationProviderOAuth2GrantTypes : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AuthorizationCode)) + { + writer.WritePropertyName("authorizationCode"u8); + writer.WriteStartObject(); + foreach (var item in AuthorizationCode) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(ClientCredentials)) + { + writer.WritePropertyName("clientCredentials"u8); + writer.WriteStartObject(); + foreach (var item in ClientCredentials) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static AuthorizationProviderOAuth2GrantTypes DeserializeAuthorizationProviderOAuth2GrantTypes(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> authorizationCode = default; + Optional> clientCredentials = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authorizationCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + authorizationCode = dictionary; + continue; + } + if (property.NameEquals("clientCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + clientCredentials = dictionary; + continue; + } + } + return new AuthorizationProviderOAuth2GrantTypes(Optional.ToDictionary(authorizationCode), Optional.ToDictionary(clientCredentials)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.cs new file mode 100644 index 000000000000..a37715d94c5b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization Provider oauth2 grant types settings. + public partial class AuthorizationProviderOAuth2GrantTypes + { + /// Initializes a new instance of . + public AuthorizationProviderOAuth2GrantTypes() + { + AuthorizationCode = new ChangeTrackingDictionary(); + ClientCredentials = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// OAuth2 authorization code grant parameters. + /// OAuth2 client credential grant parameters. + internal AuthorizationProviderOAuth2GrantTypes(IDictionary authorizationCode, IDictionary clientCredentials) + { + AuthorizationCode = authorizationCode; + ClientCredentials = clientCredentials; + } + + /// OAuth2 authorization code grant parameters. + public IDictionary AuthorizationCode { get; } + /// OAuth2 client credential grant parameters. + public IDictionary ClientCredentials { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.Serialization.cs new file mode 100644 index 000000000000..685ada06051a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationProviderOAuth2Settings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(RedirectUri)) + { + writer.WritePropertyName("redirectUrl"u8); + writer.WriteStringValue(RedirectUri.AbsoluteUri); + } + if (Optional.IsDefined(GrantTypes)) + { + writer.WritePropertyName("grantTypes"u8); + writer.WriteObjectValue(GrantTypes); + } + writer.WriteEndObject(); + } + + internal static AuthorizationProviderOAuth2Settings DeserializeAuthorizationProviderOAuth2Settings(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional redirectUri = default; + Optional grantTypes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("redirectUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redirectUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("grantTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + grantTypes = AuthorizationProviderOAuth2GrantTypes.DeserializeAuthorizationProviderOAuth2GrantTypes(property.Value); + continue; + } + } + return new AuthorizationProviderOAuth2Settings(redirectUri.Value, grantTypes.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.cs new file mode 100644 index 000000000000..935e8edf5b68 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// OAuth2 settings details. + public partial class AuthorizationProviderOAuth2Settings + { + /// Initializes a new instance of . + public AuthorizationProviderOAuth2Settings() + { + } + + /// Initializes a new instance of . + /// Redirect URL to be set in the OAuth application. + /// OAuth2 settings. + internal AuthorizationProviderOAuth2Settings(Uri redirectUri, AuthorizationProviderOAuth2GrantTypes grantTypes) + { + RedirectUri = redirectUri; + GrantTypes = grantTypes; + } + + /// Redirect URL to be set in the OAuth application. + public Uri RedirectUri { get; set; } + /// OAuth2 settings. + public AuthorizationProviderOAuth2GrantTypes GrantTypes { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationType.cs new file mode 100644 index 000000000000..f848a82a2057 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization type options. + public readonly partial struct AuthorizationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthorizationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OAuth2Value = "OAuth2"; + + /// OAuth2 authorization type. + public static AuthorizationType OAuth2 { get; } = new AuthorizationType(OAuth2Value); + /// Determines if two values are the same. + public static bool operator ==(AuthorizationType left, AuthorizationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthorizationType left, AuthorizationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AuthorizationType(string value) => new AuthorizationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthorizationType other && Equals(other); + /// + public bool Equals(AuthorizationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendBaseParametersPool.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendBaseParametersPool.Serialization.cs new file mode 100644 index 000000000000..e8c93a57c393 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendBaseParametersPool.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class BackendBaseParametersPool : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Services)) + { + writer.WritePropertyName("services"u8); + writer.WriteStartArray(); + foreach (var item in Services) + { + JsonSerializer.Serialize(writer, item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static BackendBaseParametersPool DeserializeBackendBaseParametersPool(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> services = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("services"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + services = array; + continue; + } + } + return new BackendBaseParametersPool(Optional.ToList(services)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendBaseParametersPool.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendBaseParametersPool.cs new file mode 100644 index 000000000000..2616f100a7f7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendBaseParametersPool.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The BackendBaseParametersPool. + internal partial class BackendBaseParametersPool : BackendPool + { + /// Initializes a new instance of . + public BackendBaseParametersPool() + { + } + + /// Initializes a new instance of . + /// The list of backend entities belonging to a pool. + internal BackendBaseParametersPool(IList services) : base(services) + { + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.Serialization.cs new file mode 100644 index 000000000000..30e632212394 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class BackendCircuitBreaker : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Rules)) + { + writer.WritePropertyName("rules"u8); + writer.WriteStartArray(); + foreach (var item in Rules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static BackendCircuitBreaker DeserializeBackendCircuitBreaker(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> rules = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CircuitBreakerRule.DeserializeCircuitBreakerRule(item)); + } + rules = array; + continue; + } + } + return new BackendCircuitBreaker(Optional.ToList(rules)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.cs new file mode 100644 index 000000000000..e8079f6b3410 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The configuration of the backend circuit breaker. + internal partial class BackendCircuitBreaker + { + /// Initializes a new instance of . + public BackendCircuitBreaker() + { + Rules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The rules for tripping the backend. + internal BackendCircuitBreaker(IList rules) + { + Rules = rules; + } + + /// The rules for tripping the backend. + public IList Rules { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendPool.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendPool.Serialization.cs new file mode 100644 index 000000000000..e0575126713b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendPool.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class BackendPool : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Services)) + { + writer.WritePropertyName("services"u8); + writer.WriteStartArray(); + foreach (var item in Services) + { + JsonSerializer.Serialize(writer, item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static BackendPool DeserializeBackendPool(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> services = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("services"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + services = array; + continue; + } + } + return new BackendPool(Optional.ToList(services)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendPool.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendPool.cs new file mode 100644 index 000000000000..5edd533d3422 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendPool.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Backend pool information. + internal partial class BackendPool + { + /// Initializes a new instance of . + public BackendPool() + { + Services = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of backend entities belonging to a pool. + internal BackendPool(IList services) + { + Services = services; + } + + /// The list of backend entities belonging to a pool. + public IList Services { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendType.cs new file mode 100644 index 000000000000..a9ebbfbd2f4a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Type of the backend. A backend can be either Single or Pool. + public readonly partial struct BackendType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BackendType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SingleValue = "Single"; + private const string PoolValue = "Pool"; + + /// supports single backend. + public static BackendType Single { get; } = new BackendType(SingleValue); + /// supports pool backend. + public static BackendType Pool { get; } = new BackendType(PoolValue); + /// Determines if two values are the same. + public static bool operator ==(BackendType left, BackendType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BackendType left, BackendType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator BackendType(string value) => new BackendType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BackendType other && Equals(other); + /// + public bool Equals(BackendType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.Serialization.cs new file mode 100644 index 000000000000..7d1a4f0ee006 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.Serialization.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class CircuitBreakerFailureCondition : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Percentage)) + { + writer.WritePropertyName("percentage"u8); + writer.WriteNumberValue(Percentage.Value); + } + if (Optional.IsDefined(Interval)) + { + writer.WritePropertyName("interval"u8); + writer.WriteStringValue(Interval.Value, "P"); + } + if (Optional.IsCollectionDefined(StatusCodeRanges)) + { + writer.WritePropertyName("statusCodeRanges"u8); + writer.WriteStartArray(); + foreach (var item in StatusCodeRanges) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ErrorReasons)) + { + writer.WritePropertyName("errorReasons"u8); + writer.WriteStartArray(); + foreach (var item in ErrorReasons) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static CircuitBreakerFailureCondition DeserializeCircuitBreakerFailureCondition(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional count = default; + Optional percentage = default; + Optional interval = default; + Optional> statusCodeRanges = default; + Optional> errorReasons = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("percentage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentage = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("interval"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + interval = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("statusCodeRanges"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FailureStatusCodeRange.DeserializeFailureStatusCodeRange(item)); + } + statusCodeRanges = array; + continue; + } + if (property.NameEquals("errorReasons"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + errorReasons = array; + continue; + } + } + return new CircuitBreakerFailureCondition(Optional.ToNullable(count), Optional.ToNullable(percentage), Optional.ToNullable(interval), Optional.ToList(statusCodeRanges), Optional.ToList(errorReasons)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.cs new file mode 100644 index 000000000000..735e5ed5fc85 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The trip conditions of the circuit breaker. + public partial class CircuitBreakerFailureCondition + { + /// Initializes a new instance of . + public CircuitBreakerFailureCondition() + { + StatusCodeRanges = new ChangeTrackingList(); + ErrorReasons = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The threshold for opening the circuit. + /// The threshold for opening the circuit. + /// The interval during which the failures are counted. + /// The status code ranges which are considered as failure. + /// The error reasons which are considered as failure. + internal CircuitBreakerFailureCondition(long? count, long? percentage, TimeSpan? interval, IList statusCodeRanges, IList errorReasons) + { + Count = count; + Percentage = percentage; + Interval = interval; + StatusCodeRanges = statusCodeRanges; + ErrorReasons = errorReasons; + } + + /// The threshold for opening the circuit. + public long? Count { get; set; } + /// The threshold for opening the circuit. + public long? Percentage { get; set; } + /// The interval during which the failures are counted. + public TimeSpan? Interval { get; set; } + /// The status code ranges which are considered as failure. + public IList StatusCodeRanges { get; } + /// The error reasons which are considered as failure. + public IList ErrorReasons { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.Serialization.cs new file mode 100644 index 000000000000..b16d89896a06 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class CircuitBreakerRule : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(FailureCondition)) + { + writer.WritePropertyName("failureCondition"u8); + writer.WriteObjectValue(FailureCondition); + } + if (Optional.IsDefined(TripDuration)) + { + writer.WritePropertyName("tripDuration"u8); + writer.WriteStringValue(TripDuration.Value, "P"); + } + writer.WriteEndObject(); + } + + internal static CircuitBreakerRule DeserializeCircuitBreakerRule(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional failureCondition = default; + Optional tripDuration = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("failureCondition"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + failureCondition = CircuitBreakerFailureCondition.DeserializeCircuitBreakerFailureCondition(property.Value); + continue; + } + if (property.NameEquals("tripDuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tripDuration = property.Value.GetTimeSpan("P"); + continue; + } + } + return new CircuitBreakerRule(name.Value, failureCondition.Value, Optional.ToNullable(tripDuration)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.cs new file mode 100644 index 000000000000..e6fe5d938479 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Rule configuration to trip the backend. + public partial class CircuitBreakerRule + { + /// Initializes a new instance of . + public CircuitBreakerRule() + { + } + + /// Initializes a new instance of . + /// The rule name. + /// The conditions for tripping the circuit breaker. + /// The duration for which the circuit will be tripped. + internal CircuitBreakerRule(string name, CircuitBreakerFailureCondition failureCondition, TimeSpan? tripDuration) + { + Name = name; + FailureCondition = failureCondition; + TripDuration = tripDuration; + } + + /// The rule name. + public string Name { get; set; } + /// The conditions for tripping the circuit breaker. + public CircuitBreakerFailureCondition FailureCondition { get; set; } + /// The duration for which the circuit will be tripped. + public TimeSpan? TripDuration { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationApi.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationApi.Serialization.cs new file mode 100644 index 000000000000..2e621981c12d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationApi.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class ConfigurationApi : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(LegacyApi)) + { + writer.WritePropertyName("legacyApi"u8); + writer.WriteStringValue(LegacyApi.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ConfigurationApi DeserializeConfigurationApi(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional legacyApi = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("legacyApi"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + legacyApi = new LegacyApiState(property.Value.GetString()); + continue; + } + } + return new ConfigurationApi(Optional.ToNullable(legacyApi)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationApi.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationApi.cs new file mode 100644 index 000000000000..fc3c2b79e044 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationApi.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Information regarding the Configuration API of the API Management service. + internal partial class ConfigurationApi + { + /// Initializes a new instance of . + public ConfigurationApi() + { + } + + /// Initializes a new instance of . + /// Indication whether or not the legacy Configuration API (v1) should be exposed on the API Management service. Value is optional but must be 'Enabled' or 'Disabled'. If 'Disabled', legacy Configuration API (v1) will not be available for self-hosted gateways. Default value is 'Enabled'. + internal ConfigurationApi(LegacyApiState? legacyApi) + { + LegacyApi = legacyApi; + } + + /// Indication whether or not the legacy Configuration API (v1) should be exposed on the API Management service. Value is optional but must be 'Enabled' or 'Disabled'. If 'Disabled', legacy Configuration API (v1) will not be available for self-hosted gateways. Default value is 'Enabled'. + public LegacyApiState? LegacyApi { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentFormat.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentFormat.cs index 0fe284546b62..bc64fd407bd5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentFormat.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentFormat.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - /// Format of the Content in which the API is getting imported. + /// Format of the Content in which the API is getting imported. New formats can be added in the future. public readonly partial struct ContentFormat : IEquatable { private readonly string _value; @@ -33,6 +33,10 @@ public ContentFormat(string value) private const string OpenApiLinkValue = "openapi-link"; private const string OpenApiJsonLinkValue = "openapi+json-link"; private const string GraphQLLinkValue = "graphql-link"; + private const string OdataValue = "odata"; + private const string OdataLinkValue = "odata-link"; + private const string GrpcValue = "grpc"; + private const string GrpcLinkValue = "grpc-link"; /// The contents are inline and Content type is a WADL document. public static ContentFormat WadlXml { get; } = new ContentFormat(WadlXmlValue); @@ -56,6 +60,14 @@ public ContentFormat(string value) public static ContentFormat OpenApiJsonLink { get; } = new ContentFormat(OpenApiJsonLinkValue); /// The GraphQL API endpoint hosted on a publicly accessible internet address. public static ContentFormat GraphQLLink { get; } = new ContentFormat(GraphQLLinkValue); + /// The contents are inline and Content Type is a OData XML Document. + public static ContentFormat Odata { get; } = new ContentFormat(OdataValue); + /// The OData metadata document hosted on a publicly accessible internet address. + public static ContentFormat OdataLink { get; } = new ContentFormat(OdataLinkValue); + /// The contents are inline and Content Type is a gRPC protobuf file. + public static ContentFormat Grpc { get; } = new ContentFormat(GrpcValue); + /// The gRPC protobuf file is hosted on a publicly accessible internet address. + public static ContentFormat GrpcLink { get; } = new ContentFormat(GrpcLinkValue); /// Determines if two values are the same. public static bool operator ==(ContentFormat left, ContentFormat right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeveloperPortalStatus.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeveloperPortalStatus.cs new file mode 100644 index 000000000000..e5c239c9bcb8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeveloperPortalStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Status of developer portal in this API Management service. + public readonly partial struct DeveloperPortalStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeveloperPortalStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Developer Portal is enabled for the service. + public static DeveloperPortalStatus Enabled { get; } = new DeveloperPortalStatus(EnabledValue); + /// Developer Portal is disabled for the service. + public static DeveloperPortalStatus Disabled { get; } = new DeveloperPortalStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(DeveloperPortalStatus left, DeveloperPortalStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeveloperPortalStatus left, DeveloperPortalStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DeveloperPortalStatus(string value) => new DeveloperPortalStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeveloperPortalStatus other && Equals(other); + /// + public bool Equals(DeveloperPortalStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractData.Serialization.cs new file mode 100644 index 000000000000..eb64857735d1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractData.Serialization.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class DocumentationContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DocumentationContractData DeserializeDocumentationContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional title = default; + Optional content = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("title"u8)) + { + title = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("content"u8)) + { + content = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new DocumentationContractData(id, name, type, systemData.Value, title.Value, content.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.Serialization.cs new file mode 100644 index 000000000000..7619a2d67315 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class DocumentationContractPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.cs new file mode 100644 index 000000000000..8e5de3cf6f7e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Documentation update contract details. + public partial class DocumentationContractPatch + { + /// Initializes a new instance of . + public DocumentationContractPatch() + { + } + + /// Initializes a new instance of . + /// documentation title. + /// Markdown documentation content. + internal DocumentationContractPatch(string title, string content) + { + Title = title; + Content = content; + } + + /// documentation title. + public string Title { get; set; } + /// Markdown documentation content. + public string Content { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.Serialization.cs new file mode 100644 index 000000000000..d8846a21ea02 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class DocumentationListResult + { + internal static DocumentationListResult DeserializeDocumentationListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentationContractData.DeserializeDocumentationContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DocumentationListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.cs new file mode 100644 index 000000000000..497cbcb2a5fe --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Documentation list representation. + internal partial class DocumentationListResult + { + /// Initializes a new instance of . + internal DocumentationListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Next page link if any. + internal DocumentationListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.Serialization.cs new file mode 100644 index 000000000000..769138f1768c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class FailureStatusCodeRange : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Min)) + { + writer.WritePropertyName("min"u8); + writer.WriteNumberValue(Min.Value); + } + if (Optional.IsDefined(Max)) + { + writer.WritePropertyName("max"u8); + writer.WriteNumberValue(Max.Value); + } + writer.WriteEndObject(); + } + + internal static FailureStatusCodeRange DeserializeFailureStatusCodeRange(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional min = default; + Optional max = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("min"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + min = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("max"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + max = property.Value.GetInt32(); + continue; + } + } + return new FailureStatusCodeRange(Optional.ToNullable(min), Optional.ToNullable(max)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.cs new file mode 100644 index 000000000000..fa591c79ef04 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The failure http status code range. + public partial class FailureStatusCodeRange + { + /// Initializes a new instance of . + public FailureStatusCodeRange() + { + } + + /// Initializes a new instance of . + /// The minimum http status code. + /// The maximum http status code. + internal FailureStatusCodeRange(int? min, int? max) + { + Min = min; + Max = max; + } + + /// The minimum http status code. + public int? Min { get; set; } + /// The maximum http status code. + public int? Max { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.Serialization.cs index 75ec88798375..0f52f310f438 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.Serialization.cs @@ -160,6 +160,7 @@ internal static GatewayApiData DeserializeGatewayApiData(JsonElement element) Optional path = default; Optional> protocols = default; Optional apiVersionSet = default; + Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -361,11 +362,16 @@ internal static GatewayApiData DeserializeGatewayApiData(JsonElement element) apiVersionSet = ApiVersionSetContractDetails.DeserializeApiVersionSetContractDetails(property0.Value); continue; } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } } continue; } } - return new GatewayApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value); + return new GatewayApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value, provisioningState.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.cs index 3ef8e48190d5..0b90bb3804d1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.cs @@ -47,7 +47,8 @@ public GatewayApiData() /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. - internal GatewayApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet) : base(id, name, resourceType, systemData) + /// The provisioning state. + internal GatewayApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet, string provisioningState) : base(id, name, resourceType, systemData) { Description = description; AuthenticationSettings = authenticationSettings; @@ -70,6 +71,7 @@ internal GatewayApiData(ResourceIdentifier id, string name, ResourceType resourc Path = path; Protocols = protocols; ApiVersionSet = apiVersionSet; + ProvisioningState = provisioningState; } /// Description of the API. May include HTML formatting tags. @@ -114,5 +116,7 @@ internal GatewayApiData(ResourceIdentifier id, string name, ResourceType resourc public IList Protocols { get; } /// Version set details. public ApiVersionSetContractDetails ApiVersionSet { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayDebugCredentialsContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayDebugCredentialsContract.Serialization.cs new file mode 100644 index 000000000000..8672a0fd7aa4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayDebugCredentialsContract.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class GatewayDebugCredentialsContract + { + internal static GatewayDebugCredentialsContract DeserializeGatewayDebugCredentialsContract(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional token = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("token"u8)) + { + token = property.Value.GetString(); + continue; + } + } + return new GatewayDebugCredentialsContract(token.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayDebugCredentialsContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayDebugCredentialsContract.cs new file mode 100644 index 000000000000..1caee6bc9943 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayDebugCredentialsContract.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Gateway debug credentials. + public partial class GatewayDebugCredentialsContract + { + /// Initializes a new instance of . + internal GatewayDebugCredentialsContract() + { + } + + /// Initializes a new instance of . + /// Gateway debug token. + internal GatewayDebugCredentialsContract(string token) + { + Token = token; + } + + /// Gateway debug token. + public string Token { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListDebugCredentialsContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListDebugCredentialsContract.Serialization.cs new file mode 100644 index 000000000000..56ba688d17d5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListDebugCredentialsContract.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class GatewayListDebugCredentialsContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CredentialsExpireAfter)) + { + writer.WritePropertyName("credentialsExpireAfter"u8); + writer.WriteStringValue(CredentialsExpireAfter.Value, "P"); + } + writer.WritePropertyName("purposes"u8); + writer.WriteStartArray(); + foreach (var item in Purposes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + writer.WritePropertyName("apiId"u8); + writer.WriteStringValue(ApiId); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListDebugCredentialsContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListDebugCredentialsContract.cs new file mode 100644 index 000000000000..a14a3345eb10 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListDebugCredentialsContract.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// List debug credentials properties. + public partial class GatewayListDebugCredentialsContract + { + /// Initializes a new instance of . + /// Purposes of debug credential. + /// Full resource Id of an API. + /// or is null. + public GatewayListDebugCredentialsContract(IEnumerable purposes, ResourceIdentifier apiId) + { + Argument.AssertNotNull(purposes, nameof(purposes)); + Argument.AssertNotNull(apiId, nameof(apiId)); + + Purposes = purposes.ToList(); + ApiId = apiId; + } + + /// Initializes a new instance of . + /// Credentials expiration in ISO8601 format. Maximum duration of the credentials is PT1H. When property is not specified, them value PT1H is used. + /// Purposes of debug credential. + /// Full resource Id of an API. + internal GatewayListDebugCredentialsContract(TimeSpan? credentialsExpireAfter, IList purposes, ResourceIdentifier apiId) + { + CredentialsExpireAfter = credentialsExpireAfter; + Purposes = purposes; + ApiId = apiId; + } + + /// Credentials expiration in ISO8601 format. Maximum duration of the credentials is PT1H. When property is not specified, them value PT1H is used. + public TimeSpan? CredentialsExpireAfter { get; set; } + /// Purposes of debug credential. + public IList Purposes { get; } + /// Full resource Id of an API. + public ResourceIdentifier ApiId { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListDebugCredentialsContractPurpose.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListDebugCredentialsContractPurpose.cs new file mode 100644 index 000000000000..2ca3595ec102 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListDebugCredentialsContractPurpose.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Purpose of debug credential. + public readonly partial struct GatewayListDebugCredentialsContractPurpose : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GatewayListDebugCredentialsContractPurpose(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TracingValue = "tracing"; + + /// The tracing purpose. + public static GatewayListDebugCredentialsContractPurpose Tracing { get; } = new GatewayListDebugCredentialsContractPurpose(TracingValue); + /// Determines if two values are the same. + public static bool operator ==(GatewayListDebugCredentialsContractPurpose left, GatewayListDebugCredentialsContractPurpose right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GatewayListDebugCredentialsContractPurpose left, GatewayListDebugCredentialsContractPurpose right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator GatewayListDebugCredentialsContractPurpose(string value) => new GatewayListDebugCredentialsContractPurpose(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GatewayListDebugCredentialsContractPurpose other && Equals(other); + /// + public bool Equals(GatewayListDebugCredentialsContractPurpose other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListTraceContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListTraceContract.Serialization.cs new file mode 100644 index 000000000000..9ea89f41c0b9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListTraceContract.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class GatewayListTraceContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TraceId)) + { + writer.WritePropertyName("traceId"u8); + writer.WriteStringValue(TraceId); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListTraceContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListTraceContract.cs new file mode 100644 index 000000000000..4e0222ae4fd1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListTraceContract.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// List trace properties. + public partial class GatewayListTraceContract + { + /// Initializes a new instance of . + public GatewayListTraceContract() + { + } + + /// Initializes a new instance of . + /// Trace id. + internal GatewayListTraceContract(string traceId) + { + TraceId = traceId; + } + + /// Trace id. + public string TraceId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.Serialization.cs similarity index 94% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.Serialization.cs index 69851709ceac..5957bef1b9b2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementGroupPatch : IUtf8JsonSerializable + public partial class GroupCreateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.cs similarity index 75% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.cs index ec8597d0fc37..5d422dbdb7ac 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.cs @@ -8,19 +8,19 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters supplied to the Create Group operation. - public partial class ApiManagementGroupCreateOrUpdateContent + public partial class GroupCreateParameters { - /// Initializes a new instance of . - public ApiManagementGroupCreateOrUpdateContent() + /// Initializes a new instance of . + public GroupCreateParameters() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Group name. /// Group description. /// Group type. /// Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. - internal ApiManagementGroupCreateOrUpdateContent(string displayName, string description, ApiManagementGroupType? apiManagementGroupType, string externalId) + internal GroupCreateParameters(string displayName, string description, ApiManagementGroupType? apiManagementGroupType, string externalId) { DisplayName = displayName; Description = description; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.Serialization.cs similarity index 93% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.Serialization.cs index 72bfd9337aff..0d4a63f8bd06 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementGroupCreateOrUpdateContent : IUtf8JsonSerializable + public partial class GroupUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs similarity index 78% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs index 81c6d82b92fb..5f7d64a15ce3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs @@ -8,19 +8,19 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters supplied to the Update Group operation. - public partial class ApiManagementGroupPatch + public partial class GroupUpdateParameters { - /// Initializes a new instance of . - public ApiManagementGroupPatch() + /// Initializes a new instance of . + public GroupUpdateParameters() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Group name. /// Group description. /// Group type. /// Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. - internal ApiManagementGroupPatch(string displayName, string description, ApiManagementGroupType? apiManagementGroupType, string externalId) + internal GroupUpdateParameters(string displayName, string description, ApiManagementGroupType? apiManagementGroupType, string externalId) { DisplayName = displayName; Description = description; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs index b98e3a9cea2a..5741a4bfde87 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs @@ -32,7 +32,7 @@ public HostnameConfiguration(HostnameType hostnameType, string hostName) /// System or User Assigned Managed identity clientId as generated by Azure AD, which has GET access to the keyVault containing the SSL certificate. /// Base64 Encoded certificate. /// Certificate Password. - /// Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type. + /// Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to gateway Hostname Type. /// Specify true to always negotiate client certificate on the hostname. Default Value is false. /// Certificate information. /// Certificate Source. @@ -64,7 +64,7 @@ internal HostnameConfiguration(HostnameType hostnameType, string hostName, Uri k public string EncodedCertificate { get; set; } /// Certificate Password. public string CertificatePassword { get; set; } - /// Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type. + /// Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to gateway Hostname Type. public bool? IsDefaultSslBindingEnabled { get; set; } /// Specify true to always negotiate client certificate on the hostname. Default Value is false. public bool? IsClientCertificateNegotiationEnabled { get; set; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameType.cs index 40cce8833dda..29bacd3602c9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameType.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameType.cs @@ -27,6 +27,7 @@ public HostnameType(string value) private const string ManagementValue = "Management"; private const string ScmValue = "Scm"; private const string DeveloperPortalValue = "DeveloperPortal"; + private const string ConfigurationApiValue = "ConfigurationApi"; /// Proxy. public static HostnameType Proxy { get; } = new HostnameType(ProxyValue); @@ -38,6 +39,8 @@ public HostnameType(string value) public static HostnameType Scm { get; } = new HostnameType(ScmValue); /// DeveloperPortal. public static HostnameType DeveloperPortal { get; } = new HostnameType(DeveloperPortalValue); + /// ConfigurationApi. + public static HostnameType ConfigurationApi { get; } = new HostnameType(ConfigurationApiValue); /// Determines if two values are the same. public static bool operator ==(HostnameType left, HostnameType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultRefreshState.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultRefreshState.cs new file mode 100644 index 000000000000..c534aa15714d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultRefreshState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The KeyVaultRefreshState. + public readonly partial struct KeyVaultRefreshState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public KeyVaultRefreshState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// Entities for which KeyVault refresh failed. + public static KeyVaultRefreshState True { get; } = new KeyVaultRefreshState(TrueValue); + /// Entities for which KeyVault refresh succeeded. + public static KeyVaultRefreshState False { get; } = new KeyVaultRefreshState(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(KeyVaultRefreshState left, KeyVaultRefreshState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(KeyVaultRefreshState left, KeyVaultRefreshState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator KeyVaultRefreshState(string value) => new KeyVaultRefreshState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KeyVaultRefreshState other && Equals(other); + /// + public bool Equals(KeyVaultRefreshState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LegacyApiState.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LegacyApiState.cs new file mode 100644 index 000000000000..0fd94dcd2bf2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LegacyApiState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Indication whether or not the legacy Configuration API (v1) should be exposed on the API Management service. Value is optional but must be 'Enabled' or 'Disabled'. If 'Disabled', legacy Configuration API (v1) will not be available for self-hosted gateways. Default value is 'Enabled'. + public readonly partial struct LegacyApiState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LegacyApiState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Legacy Configuration API (v1) is enabled for the service and self-hosted gateways can connect to it. + public static LegacyApiState Enabled { get; } = new LegacyApiState(EnabledValue); + /// Legacy Configuration API (v1) is disabled for the service and self-hosted gateways can not connect to it. + public static LegacyApiState Disabled { get; } = new LegacyApiState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(LegacyApiState left, LegacyApiState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LegacyApiState left, LegacyApiState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LegacyApiState(string value) => new LegacyApiState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LegacyApiState other && Equals(other); + /// + public bool Equals(LegacyApiState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LegacyPortalStatus.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LegacyPortalStatus.cs new file mode 100644 index 000000000000..99689d6cec63 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LegacyPortalStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Status of legacy portal in the API Management service. + public readonly partial struct LegacyPortalStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LegacyPortalStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Legacy Portal is enabled for the service. + public static LegacyPortalStatus Enabled { get; } = new LegacyPortalStatus(EnabledValue); + /// Legacy Portal is disabled for the service. + public static LegacyPortalStatus Disabled { get; } = new LegacyPortalStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(LegacyPortalStatus left, LegacyPortalStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LegacyPortalStatus left, LegacyPortalStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LegacyPortalStatus(string value) => new LegacyPortalStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LegacyPortalStatus other && Equals(other); + /// + public bool Equals(LegacyPortalStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/MigrateToStv2Contract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/MigrateToStv2Contract.Serialization.cs new file mode 100644 index 000000000000..b6ba181447af --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/MigrateToStv2Contract.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class MigrateToStv2Contract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/MigrateToStv2Contract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/MigrateToStv2Contract.cs new file mode 100644 index 000000000000..bfc07706ef09 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/MigrateToStv2Contract.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Describes an available API Management SKU. + public partial class MigrateToStv2Contract + { + /// Initializes a new instance of . + public MigrateToStv2Contract() + { + } + + /// Initializes a new instance of . + /// Mode of Migration to stv2. Default is PreserveIp. + internal MigrateToStv2Contract(MigrateToStv2Mode? mode) + { + Mode = mode; + } + + /// Mode of Migration to stv2. Default is PreserveIp. + public MigrateToStv2Mode? Mode { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/MigrateToStv2Mode.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/MigrateToStv2Mode.cs new file mode 100644 index 000000000000..9137e57d1a92 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/MigrateToStv2Mode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Mode of Migration to stv2. Default is PreserveIp. + public readonly partial struct MigrateToStv2Mode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MigrateToStv2Mode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PreserveIPValue = "PreserveIp"; + private const string NewIPValue = "NewIP"; + + /// Migrate API Management service to stv2 from stv1, by reserving the IP Address of the service. This will have a downtime of upto 15 minutes, while the IP address is getting migrate to new infrastructure. + public static MigrateToStv2Mode PreserveIP { get; } = new MigrateToStv2Mode(PreserveIPValue); + /// Migrate API Management service to stv2 from stv1. This will have no downtime as the service configuration will be migrated to new infrastructure, but the IP address will changed. + public static MigrateToStv2Mode NewIP { get; } = new MigrateToStv2Mode(NewIPValue); + /// Determines if two values are the same. + public static bool operator ==(MigrateToStv2Mode left, MigrateToStv2Mode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MigrateToStv2Mode left, MigrateToStv2Mode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator MigrateToStv2Mode(string value) => new MigrateToStv2Mode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MigrateToStv2Mode other && Equals(other); + /// + public bool Equals(MigrateToStv2Mode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.Serialization.cs similarity index 92% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.Serialization.cs index 98b6ad01e175..4158e9b622f6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.Serialization.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementNamedValueCreateOrUpdateContent : IUtf8JsonSerializable + public partial class NamedValueCreateContract : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -53,7 +53,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ApiManagementNamedValueCreateOrUpdateContent DeserializeApiManagementNamedValueCreateOrUpdateContent(JsonElement element) + internal static NamedValueCreateContract DeserializeNamedValueCreateContract(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -149,7 +149,7 @@ internal static ApiManagementNamedValueCreateOrUpdateContent DeserializeApiManag continue; } } - return new ApiManagementNamedValueCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value); + return new NamedValueCreateContract(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs similarity index 78% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs index 0c6675a621e4..d6b5d02ab886 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs @@ -12,15 +12,15 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// NamedValue details. - public partial class ApiManagementNamedValueCreateOrUpdateContent : ResourceData + public partial class NamedValueCreateContract : ResourceData { - /// Initializes a new instance of . - public ApiManagementNamedValueCreateOrUpdateContent() + /// Initializes a new instance of . + public NamedValueCreateContract() { Tags = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,7 +30,7 @@ public ApiManagementNamedValueCreateOrUpdateContent() /// Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. /// Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// KeyVault location details of the namedValue. - internal ApiManagementNamedValueCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractCreateProperties keyVault) : base(id, name, resourceType, systemData) + internal NamedValueCreateContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractCreateProperties keyVault) : base(id, name, resourceType, systemData) { Tags = tags; IsSecret = isSecret; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.Serialization.cs similarity index 95% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.Serialization.cs index 7482ee164940..274fbd1456f9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementNamedValuePatch : IUtf8JsonSerializable + public partial class NamedValueUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs similarity index 81% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs index 567f836875ac..3cb86fcc7f27 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs @@ -11,21 +11,21 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// NamedValue update Parameters. - public partial class ApiManagementNamedValuePatch + public partial class NamedValueUpdateParameters { - /// Initializes a new instance of . - public ApiManagementNamedValuePatch() + /// Initializes a new instance of . + public NamedValueUpdateParameters() { Tags = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Optional tags that when provided can be used to filter the NamedValue list. /// Determines whether the value is a secret and should be encrypted or not. Default value is false. /// Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. /// Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. /// KeyVault location details of the namedValue. - internal ApiManagementNamedValuePatch(IList tags, bool? isSecret, string displayName, string value, KeyVaultContractCreateProperties keyVault) + internal NamedValueUpdateParameters(IList tags, bool? isSecret, string displayName, string value, KeyVaultContractCreateProperties keyVault) { Tags = tags; IsSecret = isSecret; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NatGatewayState.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NatGatewayState.cs new file mode 100644 index 000000000000..8756121a42d9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NatGatewayState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Property can be used to enable NAT Gateway for this API Management service. + public readonly partial struct NatGatewayState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NatGatewayState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Nat Gateway is enabled for the service. + public static NatGatewayState Enabled { get; } = new NatGatewayState(EnabledValue); + /// Nat Gateway is disabled for the service. + public static NatGatewayState Disabled { get; } = new NatGatewayState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(NatGatewayState left, NatGatewayState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NatGatewayState left, NatGatewayState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NatGatewayState(string value) => new NatGatewayState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NatGatewayState other && Equals(other); + /// + public bool Equals(NatGatewayState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2GrantType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2GrantType.cs new file mode 100644 index 000000000000..acc48bc79ee3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2GrantType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// OAuth2 grant type options. + public readonly partial struct OAuth2GrantType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OAuth2GrantType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AuthorizationCodeValue = "AuthorizationCode"; + private const string ClientCredentialsValue = "ClientCredentials"; + + /// Authorization Code grant. + public static OAuth2GrantType AuthorizationCode { get; } = new OAuth2GrantType(AuthorizationCodeValue); + /// Client Credential grant. + public static OAuth2GrantType ClientCredentials { get; } = new OAuth2GrantType(ClientCredentialsValue); + /// Determines if two values are the same. + public static bool operator ==(OAuth2GrantType left, OAuth2GrantType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OAuth2GrantType left, OAuth2GrantType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator OAuth2GrantType(string value) => new OAuth2GrantType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OAuth2GrantType other && Equals(other); + /// + public bool Equals(OAuth2GrantType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.Serialization.cs similarity index 97% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.Serialization.cs index 1520341d83a8..3a9518309272 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiOperationPatch : IUtf8JsonSerializable + public partial class OperationUpdateContract : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.cs similarity index 83% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.cs index 6b92abe8bb2b..227733f04b40 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.cs @@ -11,16 +11,16 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// API Operation Update Contract details. - public partial class ApiOperationPatch + public partial class OperationUpdateContract { - /// Initializes a new instance of . - public ApiOperationPatch() + /// Initializes a new instance of . + public OperationUpdateContract() { TemplateParameters = new ChangeTrackingList(); Responses = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Collection of URL template parameters. /// Description of the operation. May include HTML formatting tags. /// An entity containing request details. @@ -29,7 +29,7 @@ public ApiOperationPatch() /// Operation Name. /// A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. /// Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - internal ApiOperationPatch(IList templateParameters, string description, RequestContract request, IList responses, string policies, string displayName, string method, string uriTemplate) + internal OperationUpdateContract(IList templateParameters, string description, RequestContract request, IList responses, string policies, string displayName, string method, string uriTemplate) { TemplateParameters = templateParameters; Description = description; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PlatformVersion.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PlatformVersion.cs index de22d200ae69..74a23c849443 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PlatformVersion.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PlatformVersion.cs @@ -26,6 +26,7 @@ public PlatformVersion(string value) private const string Stv1Value = "stv1"; private const string Stv2Value = "stv2"; private const string Mtv1Value = "mtv1"; + private const string Stv21Value = "stv2.1"; /// Platform version cannot be determined, as compute platform is not deployed. public static PlatformVersion Undetermined { get; } = new PlatformVersion(UndeterminedValue); @@ -35,6 +36,8 @@ public PlatformVersion(string value) public static PlatformVersion Stv2 { get; } = new PlatformVersion(Stv2Value); /// Platform running the service on Multi Tenant V1 platform. public static PlatformVersion Mtv1 { get; } = new PlatformVersion(Mtv1Value); + /// Platform running the service on Single Tenant V2 platform on newer Hardware. + public static PlatformVersion Stv21 { get; } = new PlatformVersion(Stv21Value); /// Determines if two values are the same. public static bool operator ==(PlatformVersion left, PlatformVersion right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyComplianceState.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyComplianceState.cs new file mode 100644 index 000000000000..aa3887a2e721 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyComplianceState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Policy Restriction Compliance State. + public readonly partial struct PolicyComplianceState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyComplianceState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "Pending"; + private const string NonCompliantValue = "NonCompliant"; + private const string CompliantValue = "Compliant"; + + /// The policy restriction compliance state has not yet been determined. + public static PolicyComplianceState Pending { get; } = new PolicyComplianceState(PendingValue); + /// The scope in restriction is out of compliance. + public static PolicyComplianceState NonCompliant { get; } = new PolicyComplianceState(NonCompliantValue); + /// The scope in restriction is in compliance. + public static PolicyComplianceState Compliant { get; } = new PolicyComplianceState(CompliantValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyComplianceState left, PolicyComplianceState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyComplianceState left, PolicyComplianceState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PolicyComplianceState(string value) => new PolicyComplianceState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyComplianceState other && Equals(other); + /// + public bool Equals(PolicyComplianceState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContentFormat.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContentFormat.cs index 7d40ffeb473a..3c1b480e45f8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContentFormat.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContentFormat.cs @@ -29,11 +29,11 @@ public PolicyContentFormat(string value) /// The contents are inline and Content type is an XML document. public static PolicyContentFormat Xml { get; } = new PolicyContentFormat(XmlValue); - /// The policy XML document is hosted on a http endpoint accessible from the API Management service. + /// The policy XML document is hosted on a HTTP endpoint accessible from the API Management service. public static PolicyContentFormat XmlLink { get; } = new PolicyContentFormat(XmlLinkValue); /// The contents are inline and Content type is a non XML encoded policy document. public static PolicyContentFormat RawXml { get; } = new PolicyContentFormat(RawXmlValue); - /// The policy document is not Xml encoded and is hosted on a http endpoint accessible from the API Management service. + /// The policy document is not XML encoded and is hosted on a HTTP endpoint accessible from the API Management service. public static PolicyContentFormat RawXmlLink { get; } = new PolicyContentFormat(RawXmlLinkValue); /// Determines if two values are the same. public static bool operator ==(PolicyContentFormat left, PolicyContentFormat right) => left.Equals(right); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs index 3c590d836863..f151c1a44f4b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. internal partial class PolicyDescriptionListResult { /// Initializes a new instance of . @@ -20,7 +20,7 @@ internal PolicyDescriptionListResult() } /// Initializes a new instance of . - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. /// Total record count number. internal PolicyDescriptionListResult(IReadOnlyList value, long? count) { @@ -28,7 +28,7 @@ internal PolicyDescriptionListResult(IReadOnlyList Descriptions of APIM policies. + /// Descriptions of API Management policies. public IReadOnlyList Value { get; } /// Total record count number. public long? Count { get; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContentFormat.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContentFormat.cs new file mode 100644 index 000000000000..ea423856a7f8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContentFormat.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The PolicyFragmentContentFormat. + public readonly partial struct PolicyFragmentContentFormat : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyFragmentContentFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string XmlValue = "xml"; + private const string RawxmlValue = "rawxml"; + + /// The contents are inline and Content type is an XML document. + public static PolicyFragmentContentFormat Xml { get; } = new PolicyFragmentContentFormat(XmlValue); + /// The contents are inline and Content type is a non XML encoded policy document. + public static PolicyFragmentContentFormat Rawxml { get; } = new PolicyFragmentContentFormat(RawxmlValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyFragmentContentFormat left, PolicyFragmentContentFormat right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyFragmentContentFormat left, PolicyFragmentContentFormat right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PolicyFragmentContentFormat(string value) => new PolicyFragmentContentFormat(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyFragmentContentFormat other && Equals(other); + /// + public bool Equals(PolicyFragmentContentFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContractData.Serialization.cs new file mode 100644 index 000000000000..6ba320e43bd0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContractData.Serialization.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class PolicyFragmentContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Format)) + { + writer.WritePropertyName("format"u8); + writer.WriteStringValue(Format.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PolicyFragmentContractData DeserializePolicyFragmentContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional value = default; + Optional description = default; + Optional format = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("value"u8)) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("format"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + format = new PolicyFragmentContentFormat(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new PolicyFragmentContractData(id, name, type, systemData.Value, value.Value, description.Value, Optional.ToNullable(format), provisioningState.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.Serialization.cs new file mode 100644 index 000000000000..802b61923f40 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PolicyFragmentListResult + { + internal static PolicyFragmentListResult DeserializePolicyFragmentListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PolicyFragmentContractData.DeserializePolicyFragmentContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PolicyFragmentListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.cs new file mode 100644 index 000000000000..26b4ebe2045c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The response of the get policy fragments operation. + internal partial class PolicyFragmentListResult + { + /// Initializes a new instance of . + internal PolicyFragmentListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Policy fragment contract value. + /// Total record count number. + /// Next page link if any. + internal PolicyFragmentListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Policy fragment contract value. + public IReadOnlyList Value { get; } + /// Total record count number. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionContractData.Serialization.cs new file mode 100644 index 000000000000..aae70e5eeb90 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionContractData.Serialization.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class PolicyRestrictionContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(RequireBase)) + { + writer.WritePropertyName("requireBase"u8); + writer.WriteStringValue(RequireBase.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PolicyRestrictionContractData DeserializePolicyRestrictionContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional scope = default; + Optional requireBase = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("scope"u8)) + { + scope = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("requireBase"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requireBase = new PolicyRestrictionRequireBase(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new PolicyRestrictionContractData(id, name, type, systemData.Value, scope.Value, Optional.ToNullable(requireBase)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionContractPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionContractPatch.Serialization.cs new file mode 100644 index 000000000000..34b52772e547 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionContractPatch.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class PolicyRestrictionContractPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(RequireBase)) + { + writer.WritePropertyName("requireBase"u8); + writer.WriteStringValue(RequireBase.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionContractPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionContractPatch.cs new file mode 100644 index 000000000000..08c37043d0a6 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionContractPatch.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Policy restriction contract details. + public partial class PolicyRestrictionContractPatch + { + /// Initializes a new instance of . + public PolicyRestrictionContractPatch() + { + } + + /// Initializes a new instance of . + /// Path to the policy document. + /// Indicates if base policy should be enforced for the policy document. + internal PolicyRestrictionContractPatch(string scope, PolicyRestrictionRequireBase? requireBase) + { + Scope = scope; + RequireBase = requireBase; + } + + /// Path to the policy document. + public string Scope { get; set; } + /// Indicates if base policy should be enforced for the policy document. + public PolicyRestrictionRequireBase? RequireBase { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionListResult.Serialization.cs new file mode 100644 index 000000000000..b8ac558a723d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PolicyRestrictionListResult + { + internal static PolicyRestrictionListResult DeserializePolicyRestrictionListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PolicyRestrictionContractData.DeserializePolicyRestrictionContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PolicyRestrictionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionListResult.cs new file mode 100644 index 000000000000..24bf62b47bef --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The response of the get policy restrictions operation. + internal partial class PolicyRestrictionListResult + { + /// Initializes a new instance of . + internal PolicyRestrictionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// Next page link if any. + internal PolicyRestrictionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets the value. + public IReadOnlyList Value { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionRequireBase.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionRequireBase.cs new file mode 100644 index 000000000000..d6356697af9b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyRestrictionRequireBase.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Indicates if base policy should be enforced for the policy document. + public readonly partial struct PolicyRestrictionRequireBase : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyRestrictionRequireBase(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// The policy is required to have base policy. + public static PolicyRestrictionRequireBase True { get; } = new PolicyRestrictionRequireBase(TrueValue); + /// The policy does not require to have base policy. + public static PolicyRestrictionRequireBase False { get; } = new PolicyRestrictionRequireBase(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyRestrictionRequireBase left, PolicyRestrictionRequireBase right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyRestrictionRequireBase left, PolicyRestrictionRequireBase right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PolicyRestrictionRequireBase(string value) => new PolicyRestrictionRequireBase(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyRestrictionRequireBase other && Equals(other); + /// + public bool Equals(PolicyRestrictionRequireBase other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigContractData.Serialization.cs new file mode 100644 index 000000000000..d2ef20143200 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigContractData.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class PortalConfigContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(EnableBasicAuth)) + { + writer.WritePropertyName("enableBasicAuth"u8); + writer.WriteBooleanValue(EnableBasicAuth.Value); + } + if (Optional.IsDefined(Signin)) + { + writer.WritePropertyName("signin"u8); + writer.WriteObjectValue(Signin); + } + if (Optional.IsDefined(Signup)) + { + writer.WritePropertyName("signup"u8); + writer.WriteObjectValue(Signup); + } + if (Optional.IsDefined(Delegation)) + { + writer.WritePropertyName("delegation"u8); + writer.WriteObjectValue(Delegation); + } + if (Optional.IsDefined(Cors)) + { + writer.WritePropertyName("cors"u8); + writer.WriteObjectValue(Cors); + } + if (Optional.IsDefined(Csp)) + { + writer.WritePropertyName("csp"u8); + writer.WriteObjectValue(Csp); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PortalConfigContractData DeserializePortalConfigContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional enableBasicAuth = default; + Optional signin = default; + Optional signup = default; + Optional delegation = default; + Optional cors = default; + Optional csp = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("enableBasicAuth"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableBasicAuth = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("signin"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + signin = PortalConfigPropertiesSignin.DeserializePortalConfigPropertiesSignin(property0.Value); + continue; + } + if (property0.NameEquals("signup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + signup = PortalConfigPropertiesSignup.DeserializePortalConfigPropertiesSignup(property0.Value); + continue; + } + if (property0.NameEquals("delegation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + delegation = PortalConfigDelegationProperties.DeserializePortalConfigDelegationProperties(property0.Value); + continue; + } + if (property0.NameEquals("cors"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cors = PortalConfigCorsProperties.DeserializePortalConfigCorsProperties(property0.Value); + continue; + } + if (property0.NameEquals("csp"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + csp = PortalConfigCspProperties.DeserializePortalConfigCspProperties(property0.Value); + continue; + } + } + continue; + } + } + return new PortalConfigContractData(id, name, type, systemData.Value, Optional.ToNullable(enableBasicAuth), signin.Value, signup.Value, delegation.Value, cors.Value, csp.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.Serialization.cs new file mode 100644 index 000000000000..6557c8698a27 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PortalConfigCorsProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AllowedOrigins)) + { + writer.WritePropertyName("allowedOrigins"u8); + writer.WriteStartArray(); + foreach (var item in AllowedOrigins) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static PortalConfigCorsProperties DeserializePortalConfigCorsProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> allowedOrigins = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("allowedOrigins"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedOrigins = array; + continue; + } + } + return new PortalConfigCorsProperties(Optional.ToList(allowedOrigins)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.cs new file mode 100644 index 000000000000..97c185253245 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The developer portal Cross-Origin Resource Sharing (CORS) settings. + internal partial class PortalConfigCorsProperties + { + /// Initializes a new instance of . + public PortalConfigCorsProperties() + { + AllowedOrigins = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Allowed origins, e.g. `https://trusted.com`. + internal PortalConfigCorsProperties(IList allowedOrigins) + { + AllowedOrigins = allowedOrigins; + } + + /// Allowed origins, e.g. `https://trusted.com`. + public IList AllowedOrigins { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.Serialization.cs new file mode 100644 index 000000000000..f794a806ed81 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.Serialization.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class PortalConfigCspProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsCollectionDefined(ReportUri)) + { + writer.WritePropertyName("reportUri"u8); + writer.WriteStartArray(); + foreach (var item in ReportUri) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.AbsoluteUri); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AllowedSources)) + { + writer.WritePropertyName("allowedSources"u8); + writer.WriteStartArray(); + foreach (var item in AllowedSources) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static PortalConfigCspProperties DeserializePortalConfigCspProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional mode = default; + Optional> reportUri = default; + Optional> allowedSources = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new PortalSettingsCspMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("reportUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(new Uri(item.GetString())); + } + } + reportUri = array; + continue; + } + if (property.NameEquals("allowedSources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedSources = array; + continue; + } + } + return new PortalConfigCspProperties(Optional.ToNullable(mode), Optional.ToList(reportUri), Optional.ToList(allowedSources)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.cs new file mode 100644 index 000000000000..a5b63abf6879 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The developer portal Content Security Policy (CSP) settings. + public partial class PortalConfigCspProperties + { + /// Initializes a new instance of . + public PortalConfigCspProperties() + { + ReportUri = new ChangeTrackingList(); + AllowedSources = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The mode of the developer portal Content Security Policy (CSP). + /// The URLs used by the browser to report CSP violations. + /// Allowed sources, e.g. `*.trusted.com`, `trusted.com`, `https://`. + internal PortalConfigCspProperties(PortalSettingsCspMode? mode, IList reportUri, IList allowedSources) + { + Mode = mode; + ReportUri = reportUri; + AllowedSources = allowedSources; + } + + /// The mode of the developer portal Content Security Policy (CSP). + public PortalSettingsCspMode? Mode { get; set; } + /// The URLs used by the browser to report CSP violations. + public IList ReportUri { get; } + /// Allowed sources, e.g. `*.trusted.com`, `trusted.com`, `https://`. + public IList AllowedSources { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.Serialization.cs new file mode 100644 index 000000000000..4d730db18ea1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.Serialization.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class PortalConfigDelegationProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DelegateRegistration)) + { + writer.WritePropertyName("delegateRegistration"u8); + writer.WriteBooleanValue(DelegateRegistration.Value); + } + if (Optional.IsDefined(DelegateSubscription)) + { + writer.WritePropertyName("delegateSubscription"u8); + writer.WriteBooleanValue(DelegateSubscription.Value); + } + if (Optional.IsDefined(DelegationUri)) + { + writer.WritePropertyName("delegationUrl"u8); + writer.WriteStringValue(DelegationUri.AbsoluteUri); + } + if (Optional.IsDefined(ValidationKey)) + { + writer.WritePropertyName("validationKey"u8); + writer.WriteStringValue(ValidationKey); + } + writer.WriteEndObject(); + } + + internal static PortalConfigDelegationProperties DeserializePortalConfigDelegationProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional delegateRegistration = default; + Optional delegateSubscription = default; + Optional delegationUri = default; + Optional validationKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("delegateRegistration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + delegateRegistration = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("delegateSubscription"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + delegateSubscription = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("delegationUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + delegationUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("validationKey"u8)) + { + validationKey = property.Value.GetString(); + continue; + } + } + return new PortalConfigDelegationProperties(Optional.ToNullable(delegateRegistration), Optional.ToNullable(delegateSubscription), delegationUri.Value, validationKey.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.cs new file mode 100644 index 000000000000..edfe33527679 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The PortalConfigDelegationProperties. + public partial class PortalConfigDelegationProperties + { + /// Initializes a new instance of . + public PortalConfigDelegationProperties() + { + } + + /// Initializes a new instance of . + /// Enable or disable delegation for user registration. + /// Enable or disable delegation for product subscriptions. + /// A delegation endpoint URL. + /// A base64-encoded validation key to ensure requests originate from Azure API Management service. + internal PortalConfigDelegationProperties(bool? delegateRegistration, bool? delegateSubscription, Uri delegationUri, string validationKey) + { + DelegateRegistration = delegateRegistration; + DelegateSubscription = delegateSubscription; + DelegationUri = delegationUri; + ValidationKey = validationKey; + } + + /// Enable or disable delegation for user registration. + public bool? DelegateRegistration { get; set; } + /// Enable or disable delegation for product subscriptions. + public bool? DelegateSubscription { get; set; } + /// A delegation endpoint URL. + public Uri DelegationUri { get; set; } + /// A base64-encoded validation key to ensure requests originate from Azure API Management service. + public string ValidationKey { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.Serialization.cs new file mode 100644 index 000000000000..943d90209b30 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PortalConfigListResult + { + internal static PortalConfigListResult DeserializePortalConfigListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PortalConfigContractData.DeserializePortalConfigContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PortalConfigListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.cs new file mode 100644 index 000000000000..9326f35a2df8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The collection of the developer portal configurations. + internal partial class PortalConfigListResult + { + /// Initializes a new instance of . + internal PortalConfigListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The developer portal configurations. + /// Next page link if any. + internal PortalConfigListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The developer portal configurations. + public IReadOnlyList Value { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.Serialization.cs new file mode 100644 index 000000000000..599a16ff622d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PortalConfigPropertiesSignin : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Require)) + { + writer.WritePropertyName("require"u8); + writer.WriteBooleanValue(Require.Value); + } + writer.WriteEndObject(); + } + + internal static PortalConfigPropertiesSignin DeserializePortalConfigPropertiesSignin(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional require = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("require"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + require = property.Value.GetBoolean(); + continue; + } + } + return new PortalConfigPropertiesSignin(Optional.ToNullable(require)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.cs new file mode 100644 index 000000000000..b3b920f9b8e4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The PortalConfigPropertiesSignin. + internal partial class PortalConfigPropertiesSignin + { + /// Initializes a new instance of . + public PortalConfigPropertiesSignin() + { + } + + /// Initializes a new instance of . + /// Redirect anonymous users to the sign-in page. + internal PortalConfigPropertiesSignin(bool? require) + { + Require = require; + } + + /// Redirect anonymous users to the sign-in page. + public bool? Require { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.Serialization.cs new file mode 100644 index 000000000000..ca8b35ce1ef1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PortalConfigPropertiesSignup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TermsOfService)) + { + writer.WritePropertyName("termsOfService"u8); + writer.WriteObjectValue(TermsOfService); + } + writer.WriteEndObject(); + } + + internal static PortalConfigPropertiesSignup DeserializePortalConfigPropertiesSignup(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional termsOfService = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("termsOfService"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + termsOfService = PortalConfigTermsOfServiceProperties.DeserializePortalConfigTermsOfServiceProperties(property.Value); + continue; + } + } + return new PortalConfigPropertiesSignup(termsOfService.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.cs new file mode 100644 index 000000000000..9dd6bba18227 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The PortalConfigPropertiesSignup. + internal partial class PortalConfigPropertiesSignup + { + /// Initializes a new instance of . + public PortalConfigPropertiesSignup() + { + } + + /// Initializes a new instance of . + /// Terms of service settings. + internal PortalConfigPropertiesSignup(PortalConfigTermsOfServiceProperties termsOfService) + { + TermsOfService = termsOfService; + } + + /// Terms of service settings. + public PortalConfigTermsOfServiceProperties TermsOfService { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.Serialization.cs new file mode 100644 index 000000000000..f76f745ba987 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class PortalConfigTermsOfServiceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + } + if (Optional.IsDefined(RequireConsent)) + { + writer.WritePropertyName("requireConsent"u8); + writer.WriteBooleanValue(RequireConsent.Value); + } + writer.WriteEndObject(); + } + + internal static PortalConfigTermsOfServiceProperties DeserializePortalConfigTermsOfServiceProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional text = default; + Optional requireConsent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("requireConsent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requireConsent = property.Value.GetBoolean(); + continue; + } + } + return new PortalConfigTermsOfServiceProperties(text.Value, Optional.ToNullable(requireConsent)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.cs new file mode 100644 index 000000000000..d2affb84c3b7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Terms of service contract properties. + public partial class PortalConfigTermsOfServiceProperties + { + /// Initializes a new instance of . + public PortalConfigTermsOfServiceProperties() + { + } + + /// Initializes a new instance of . + /// A terms of service text. + /// Ask user for consent to the terms of service. + internal PortalConfigTermsOfServiceProperties(string text, bool? requireConsent) + { + Text = text; + RequireConsent = requireConsent; + } + + /// A terms of service text. + public string Text { get; set; } + /// Ask user for consent to the terms of service. + public bool? RequireConsent { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsCspMode.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsCspMode.cs new file mode 100644 index 000000000000..a8207a74e07a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsCspMode.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The mode of the developer portal Content Security Policy (CSP). + public readonly partial struct PortalSettingsCspMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PortalSettingsCspMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "enabled"; + private const string DisabledValue = "disabled"; + private const string ReportOnlyValue = "reportOnly"; + + /// The browser will block requests not matching allowed origins. + public static PortalSettingsCspMode Enabled { get; } = new PortalSettingsCspMode(EnabledValue); + /// The browser will not apply the origin restrictions. + public static PortalSettingsCspMode Disabled { get; } = new PortalSettingsCspMode(DisabledValue); + /// The browser will report requests not matching allowed origins without blocking them. + public static PortalSettingsCspMode ReportOnly { get; } = new PortalSettingsCspMode(ReportOnlyValue); + /// Determines if two values are the same. + public static bool operator ==(PortalSettingsCspMode left, PortalSettingsCspMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PortalSettingsCspMode left, PortalSettingsCspMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PortalSettingsCspMode(string value) => new PortalSettingsCspMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PortalSettingsCspMode other && Equals(other); + /// + public bool Equals(PortalSettingsCspMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs index 960aefbf84db..c44995adfd1b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. internal partial class PortalSettingsListResult { /// Initializes a new instance of . @@ -20,7 +20,7 @@ internal PortalSettingsListResult() } /// Initializes a new instance of . - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. /// Total record count number. internal PortalSettingsListResult(IReadOnlyList value, long? count) { @@ -28,7 +28,7 @@ internal PortalSettingsListResult(IReadOnlyList valu Count = count; } - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. public IReadOnlyList Value { get; } /// Total record count number. public long? Count { get; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.Serialization.cs index ae71c4545777..f56f479b0f3c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.Serialization.cs @@ -160,6 +160,7 @@ internal static ProductApiData DeserializeProductApiData(JsonElement element) Optional path = default; Optional> protocols = default; Optional apiVersionSet = default; + Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -361,11 +362,16 @@ internal static ProductApiData DeserializeProductApiData(JsonElement element) apiVersionSet = ApiVersionSetContractDetails.DeserializeApiVersionSetContractDetails(property0.Value); continue; } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } } continue; } } - return new ProductApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value); + return new ProductApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value, provisioningState.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.cs index 27c420c71131..6bd67be0c055 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.cs @@ -47,7 +47,8 @@ public ProductApiData() /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. - internal ProductApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet) : base(id, name, resourceType, systemData) + /// The provisioning state. + internal ProductApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet, string provisioningState) : base(id, name, resourceType, systemData) { Description = description; AuthenticationSettings = authenticationSettings; @@ -70,6 +71,7 @@ internal ProductApiData(ResourceIdentifier id, string name, ResourceType resourc Path = path; Protocols = protocols; ApiVersionSet = apiVersionSet; + ProvisioningState = provisioningState; } /// Description of the API. May include HTML formatting tags. @@ -114,5 +116,7 @@ internal ProductApiData(ResourceIdentifier id, string name, ResourceType resourc public IList Protocols { get; } /// Version set details. public ApiVersionSetContractDetails ApiVersionSet { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkContractData.Serialization.cs new file mode 100644 index 000000000000..d79641030cba --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkContractData.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class ProductApiLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ApiId)) + { + writer.WritePropertyName("apiId"u8); + writer.WriteStringValue(ApiId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ProductApiLinkContractData DeserializeProductApiLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional apiId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("apiId"u8)) + { + apiId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ProductApiLinkContractData(id, name, type, systemData.Value, apiId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.Serialization.cs new file mode 100644 index 000000000000..e8828e4e3955 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class ProductApiLinkListResult + { + internal static ProductApiLinkListResult DeserializeProductApiLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProductApiLinkContractData.DeserializeProductApiLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ProductApiLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.cs new file mode 100644 index 000000000000..fdff664a45e4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Product-API link list representation. + internal partial class ProductApiLinkListResult + { + /// Initializes a new instance of . + internal ProductApiLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal ProductApiLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkContractData.Serialization.cs new file mode 100644 index 000000000000..c3d406435e99 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkContractData.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class ProductGroupLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ProductGroupLinkContractData DeserializeProductGroupLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional groupId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("groupId"u8)) + { + groupId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ProductGroupLinkContractData(id, name, type, systemData.Value, groupId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.Serialization.cs new file mode 100644 index 000000000000..902f96224c2f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class ProductGroupLinkListResult + { + internal static ProductGroupLinkListResult DeserializeProductGroupLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ProductGroupLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.cs new file mode 100644 index 000000000000..f1764517624e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Product-group link list representation. + internal partial class ProductGroupLinkListResult + { + /// Initializes a new instance of . + internal ProductGroupLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal ProductGroupLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.Serialization.cs similarity index 96% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.Serialization.cs index 8e2983618917..e44906a92093 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementProductPatch : IUtf8JsonSerializable + public partial class ProductUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs similarity index 89% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs index 6842f387b7d2..42645ec28905 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs @@ -8,14 +8,14 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Product Update parameters. - public partial class ApiManagementProductPatch + public partial class ProductUpdateParameters { - /// Initializes a new instance of . - public ApiManagementProductPatch() + /// Initializes a new instance of . + public ProductUpdateParameters() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Product description. May include HTML formatting tags. /// Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. /// Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. @@ -23,7 +23,7 @@ public ApiManagementProductPatch() /// Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. /// whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. /// Product name. - internal ApiManagementProductPatch(string description, string terms, bool? isSubscriptionRequired, bool? isApprovalRequired, int? subscriptionsLimit, ApiManagementProductState? state, string displayName) + internal ProductUpdateParameters(string description, string terms, bool? isSubscriptionRequired, bool? isApprovalRequired, int? subscriptionsLimit, ApiManagementProductState? state, string displayName) { Description = description; Terms = terms; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs index 17934893b339..9a7d6ca3ced9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs @@ -36,7 +36,7 @@ internal ReportRecordContract() /// Subscription identifier path. /subscriptions/{subscriptionId}. /// Number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. /// Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests. - /// Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. + /// Number of calls failed due to gateway or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. /// Number of other calls. /// Total number of calls. /// Bandwidth consumed. @@ -109,7 +109,7 @@ internal ReportRecordContract(string name, DateTimeOffset? timestamp, string int public int? CallCountSuccess { get; } /// Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests. public int? CallCountBlocked { get; } - /// Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. + /// Number of calls failed due to gateway or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. public int? CallCountFailed { get; } /// Number of other calls. public int? CallCountOther { get; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractData.Serialization.cs new file mode 100644 index 000000000000..bb36b05af4e0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractData.Serialization.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class ResolverContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ResolverContractData DeserializeResolverContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional displayName = default; + Optional path = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("path"u8)) + { + path = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ResolverContractData(id, name, type, systemData.Value, displayName.Value, path.Value, description.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.Serialization.cs new file mode 100644 index 000000000000..bbd86e09f5a2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class ResolverContractPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.cs new file mode 100644 index 000000000000..6f0a7a0c300f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// GraphQL API Resolver Update Contract details. + public partial class ResolverContractPatch + { + /// Initializes a new instance of . + public ResolverContractPatch() + { + } + + /// Initializes a new instance of . + /// Resolver Name. + /// Path is type/field being resolved. + /// Description of the resolver. May include HTML formatting tags. + internal ResolverContractPatch(string displayName, string path, string description) + { + DisplayName = displayName; + Path = path; + Description = description; + } + + /// Resolver Name. + public string DisplayName { get; set; } + /// Path is type/field being resolved. + public string Path { get; set; } + /// Description of the resolver. May include HTML formatting tags. + public string Description { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.Serialization.cs new file mode 100644 index 000000000000..17a497d6f857 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class ResolverListResult + { + internal static ResolverListResult DeserializeResolverListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResolverContractData.DeserializeResolverContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ResolverListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.cs new file mode 100644 index 000000000000..afbe27476570 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Resolver list representation. + internal partial class ResolverListResult + { + /// Initializes a new instance of . + internal ResolverListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal ResolverListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.Serialization.cs new file mode 100644 index 000000000000..fe3eacb654ca --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class ResourceCollectionValueItem : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ResourceCollectionValueItem DeserializeResourceCollectionValueItem(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new ResourceCollectionValueItem(id, name, type, systemData.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.cs new file mode 100644 index 000000000000..60e56d40bbca --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The ResourceCollectionValueItem. + public partial class ResourceCollectionValueItem : ResourceData + { + /// Initializes a new instance of . + public ResourceCollectionValueItem() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + internal ResourceCollectionValueItem(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData) : base(id, name, resourceType, systemData) + { + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.Serialization.cs new file mode 100644 index 000000000000..e06d7713289d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class ResourceListResult + { + internal static ResourceListResult DeserializeResourceListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceCollectionValueItem.DeserializeResourceCollectionValueItem(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ResourceListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.cs new file mode 100644 index 000000000000..ef673705ff37 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// A collection of resources. + internal partial class ResourceListResult + { + /// Initializes a new instance of . + internal ResourceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A collection of resources. + /// Total record count number. + /// Next page link if any. + internal ResourceListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// A collection of resources. + public IReadOnlyList Value { get; } + /// Total record count number. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SoapApiType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SoapApiType.cs index ae628a9eb975..a457a77801dc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SoapApiType.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SoapApiType.cs @@ -16,6 +16,7 @@ namespace Azure.ResourceManager.ApiManagement.Models /// * `soap` creates a SOAP pass-through API /// * `websocket` creates websocket API /// * `graphql` creates GraphQL API. + /// New types can be added in the future. /// public readonly partial struct SoapApiType : IEquatable { @@ -32,6 +33,8 @@ public SoapApiType(string value) private const string SoapPassThroughValue = "soap"; private const string WebSocketValue = "websocket"; private const string GraphQLValue = "graphql"; + private const string ODataValue = "odata"; + private const string GRPCValue = "grpc"; /// Imports a SOAP API having a RESTful front end. public static SoapApiType SoapToRest { get; } = new SoapApiType(SoapToRestValue); @@ -41,6 +44,10 @@ public SoapApiType(string value) public static SoapApiType WebSocket { get; } = new SoapApiType(WebSocketValue); /// Imports the API having a GraphQL front end. public static SoapApiType GraphQL { get; } = new SoapApiType(GraphQLValue); + /// Imports the API having a OData front end. + public static SoapApiType OData { get; } = new SoapApiType(ODataValue); + /// Imports the API having a gRPC front end. + public static SoapApiType GRPC { get; } = new SoapApiType(GRPCValue); /// Determines if two values are the same. public static bool operator ==(SoapApiType left, SoapApiType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.Serialization.cs similarity index 95% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.Serialization.cs index ef510d594bc3..7d02fe2453c2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSubscriptionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class SubscriptionCreateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs similarity index 85% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs index 23810188823f..811b3ef68c21 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs @@ -8,14 +8,14 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Subscription create details. - public partial class ApiManagementSubscriptionCreateOrUpdateContent + public partial class SubscriptionCreateParameters { - /// Initializes a new instance of . - public ApiManagementSubscriptionCreateOrUpdateContent() + /// Initializes a new instance of . + public SubscriptionCreateParameters() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// User (user id path) for whom subscription is being created in form /users/{userId}. /// Scope like /products/{productId} or /apis or /apis/{apiId}. /// Subscription name. @@ -23,7 +23,7 @@ public ApiManagementSubscriptionCreateOrUpdateContent() /// Secondary subscription key. If not specified during request key will be generated automatically. /// Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. /// Determines whether tracing can be enabled. - internal ApiManagementSubscriptionCreateOrUpdateContent(string ownerId, string scope, string displayName, string primaryKey, string secondaryKey, SubscriptionState? state, bool? allowTracing) + internal SubscriptionCreateParameters(string ownerId, string scope, string displayName, string primaryKey, string secondaryKey, SubscriptionState? state, bool? allowTracing) { OwnerId = ownerId; Scope = scope; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.Serialization.cs similarity index 96% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.Serialization.cs index 6836cff6f88c..fe34bd009df8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSubscriptionPatch : IUtf8JsonSerializable + public partial class SubscriptionUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs similarity index 88% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs index 28f89356d8df..0cf6078cceff 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs @@ -10,14 +10,14 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Subscription update details. - public partial class ApiManagementSubscriptionPatch + public partial class SubscriptionUpdateParameters { - /// Initializes a new instance of . - public ApiManagementSubscriptionPatch() + /// Initializes a new instance of . + public SubscriptionUpdateParameters() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// User identifier path: /users/{userId}. /// Scope like /products/{productId} or /apis or /apis/{apiId}. /// Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. @@ -27,7 +27,7 @@ public ApiManagementSubscriptionPatch() /// Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. /// Comments describing subscription state change by the administrator when the state is changed to the 'rejected'. /// Determines whether tracing can be enabled. - internal ApiManagementSubscriptionPatch(string ownerId, string scope, DateTimeOffset? expireOn, string displayName, string primaryKey, string secondaryKey, SubscriptionState? state, string stateComment, bool? allowTracing) + internal SubscriptionUpdateParameters(string ownerId, string scope, DateTimeOffset? expireOn, string displayName, string primaryKey, string secondaryKey, SubscriptionState? state, string stateComment, bool? allowTracing) { OwnerId = ownerId; Scope = scope; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkContractData.Serialization.cs new file mode 100644 index 000000000000..b2d2ed071c0a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkContractData.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class TagApiLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ApiId)) + { + writer.WritePropertyName("apiId"u8); + writer.WriteStringValue(ApiId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TagApiLinkContractData DeserializeTagApiLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional apiId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("apiId"u8)) + { + apiId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new TagApiLinkContractData(id, name, type, systemData.Value, apiId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.Serialization.cs new file mode 100644 index 000000000000..a64b3921a916 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class TagApiLinkListResult + { + internal static TagApiLinkListResult DeserializeTagApiLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TagApiLinkContractData.DeserializeTagApiLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TagApiLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.cs new file mode 100644 index 000000000000..d933c388977c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Tag-API link list representation. + internal partial class TagApiLinkListResult + { + /// Initializes a new instance of . + internal TagApiLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal TagApiLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkContractData.Serialization.cs new file mode 100644 index 000000000000..e241a38f73c3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkContractData.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class TagOperationLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(OperationId)) + { + writer.WritePropertyName("operationId"u8); + writer.WriteStringValue(OperationId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TagOperationLinkContractData DeserializeTagOperationLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional operationId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("operationId"u8)) + { + operationId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new TagOperationLinkContractData(id, name, type, systemData.Value, operationId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.Serialization.cs new file mode 100644 index 000000000000..db9aa71edc04 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class TagOperationLinkListResult + { + internal static TagOperationLinkListResult DeserializeTagOperationLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TagOperationLinkContractData.DeserializeTagOperationLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TagOperationLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.cs new file mode 100644 index 000000000000..7036818b01ad --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Tag-operation link list representation. + internal partial class TagOperationLinkListResult + { + /// Initializes a new instance of . + internal TagOperationLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal TagOperationLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkContractData.Serialization.cs new file mode 100644 index 000000000000..b7023d4d3d31 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkContractData.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class TagProductLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ProductId)) + { + writer.WritePropertyName("productId"u8); + writer.WriteStringValue(ProductId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TagProductLinkContractData DeserializeTagProductLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional productId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("productId"u8)) + { + productId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new TagProductLinkContractData(id, name, type, systemData.Value, productId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.Serialization.cs new file mode 100644 index 000000000000..bbf578a8d2dd --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class TagProductLinkListResult + { + internal static TagProductLinkListResult DeserializeTagProductLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TagProductLinkContractData.DeserializeTagProductLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TagProductLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.cs new file mode 100644 index 000000000000..2ef9df1bd91a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Tag-product link list representation. + internal partial class TagProductLinkListResult + { + /// Initializes a new instance of . + internal TagProductLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal TagProductLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TranslateRequiredQueryParametersConduct.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TranslateRequiredQueryParametersConduct.cs new file mode 100644 index 000000000000..b03e07567606 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TranslateRequiredQueryParametersConduct.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Strategy of translating required query parameters to template ones. By default has value 'template'. Possible values: 'template', 'query'. + public readonly partial struct TranslateRequiredQueryParametersConduct : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TranslateRequiredQueryParametersConduct(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TemplateValue = "template"; + private const string QueryValue = "query"; + + /// Translates required query parameters to template ones. Is a default value. + public static TranslateRequiredQueryParametersConduct Template { get; } = new TranslateRequiredQueryParametersConduct(TemplateValue); + /// Leaves required query parameters as they are (no translation done). + public static TranslateRequiredQueryParametersConduct Query { get; } = new TranslateRequiredQueryParametersConduct(QueryValue); + /// Determines if two values are the same. + public static bool operator ==(TranslateRequiredQueryParametersConduct left, TranslateRequiredQueryParametersConduct right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TranslateRequiredQueryParametersConduct left, TranslateRequiredQueryParametersConduct right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TranslateRequiredQueryParametersConduct(string value) => new TranslateRequiredQueryParametersConduct(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TranslateRequiredQueryParametersConduct other && Equals(other); + /// + public bool Equals(TranslateRequiredQueryParametersConduct other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiContractData.Serialization.cs new file mode 100644 index 000000000000..525c22772610 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiContractData.Serialization.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class WikiContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Documents)) + { + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WikiContractData DeserializeWikiContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional> documents = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("documents"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(WikiDocumentationContract.DeserializeWikiDocumentationContract(item)); + } + documents = array; + continue; + } + } + continue; + } + } + return new WikiContractData(id, name, type, systemData.Value, Optional.ToList(documents)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.Serialization.cs new file mode 100644 index 000000000000..74e7b7e40431 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class WikiDocumentationContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DocumentationId)) + { + writer.WritePropertyName("documentationId"u8); + writer.WriteStringValue(DocumentationId); + } + writer.WriteEndObject(); + } + + internal static WikiDocumentationContract DeserializeWikiDocumentationContract(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional documentationId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documentationId"u8)) + { + documentationId = property.Value.GetString(); + continue; + } + } + return new WikiDocumentationContract(documentationId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.cs new file mode 100644 index 000000000000..1484cec10b1d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Wiki documentation details. + public partial class WikiDocumentationContract + { + /// Initializes a new instance of . + public WikiDocumentationContract() + { + } + + /// Initializes a new instance of . + /// Documentation Identifier. + internal WikiDocumentationContract(string documentationId) + { + DocumentationId = documentationId; + } + + /// Documentation Identifier. + public string DocumentationId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.Serialization.cs new file mode 100644 index 000000000000..9358fc04f6c1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class WikiUpdateContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Documents)) + { + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.cs new file mode 100644 index 000000000000..44de218c103b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Wiki update contract details. + public partial class WikiUpdateContract + { + /// Initializes a new instance of . + public WikiUpdateContract() + { + Documents = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Collection wiki documents included into this wiki. + internal WikiUpdateContract(IList documents) + { + Documents = documents; + } + + /// Collection wiki documents included into this wiki. + public IList Documents { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceContractData.Serialization.cs new file mode 100644 index 000000000000..c1d81eb32610 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceContractData.Serialization.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class WorkspaceContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkspaceContractData DeserializeWorkspaceContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional displayName = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new WorkspaceContractData(id, name, type, systemData.Value, displayName.Value, description.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.Serialization.cs new file mode 100644 index 000000000000..0557f633eb29 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class WorkspaceListResult + { + internal static WorkspaceListResult DeserializeWorkspaceListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkspaceContractData.DeserializeWorkspaceContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkspaceListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.cs new file mode 100644 index 000000000000..0a531e372503 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged workspace list representation. + internal partial class WorkspaceListResult + { + /// Initializes a new instance of . + internal WorkspaceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal WorkspaceListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyFragmentContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyFragmentContractData.cs new file mode 100644 index 000000000000..828e37e9db27 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyFragmentContractData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the PolicyFragmentContract data model. + /// Policy fragment contract details. + /// + public partial class PolicyFragmentContractData : ResourceData + { + /// Initializes a new instance of . + public PolicyFragmentContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Contents of the policy fragment. + /// Policy fragment description. + /// Format of the policy fragment content. + /// The provisioning state. + internal PolicyFragmentContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, string description, PolicyFragmentContentFormat? format, string provisioningState) : base(id, name, resourceType, systemData) + { + Value = value; + Description = description; + Format = format; + ProvisioningState = provisioningState; + } + + /// Contents of the policy fragment. + public string Value { get; set; } + /// Policy fragment description. + public string Description { get; set; } + /// Format of the policy fragment content. + public PolicyFragmentContentFormat? Format { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyRestrictionContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyRestrictionContractCollection.cs new file mode 100644 index 000000000000..64fa7f01393e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyRestrictionContractCollection.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetPolicyRestrictionContracts method from an instance of . + /// + public partial class PolicyRestrictionContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _policyRestrictionContractPolicyRestrictionClientDiagnostics; + private readonly PolicyRestrictionRestOperations _policyRestrictionContractPolicyRestrictionRestClient; + + /// Initializes a new instance of the class for mocking. + protected PolicyRestrictionContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal PolicyRestrictionContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _policyRestrictionContractPolicyRestrictionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", PolicyRestrictionContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PolicyRestrictionContractResource.ResourceType, out string policyRestrictionContractPolicyRestrictionApiVersion); + _policyRestrictionContractPolicyRestrictionRestClient = new PolicyRestrictionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, policyRestrictionContractPolicyRestrictionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates the policy restriction configuration of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Policy restrictions after an entity level. + /// The policy restriction to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string policyRestrictionId, PolicyRestrictionContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _policyRestrictionContractPolicyRestrictionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyRestrictionId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new PolicyRestrictionContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates the policy restriction configuration of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Policy restrictions after an entity level. + /// The policy restriction to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string policyRestrictionId, PolicyRestrictionContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _policyRestrictionContractPolicyRestrictionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyRestrictionId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new PolicyRestrictionContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy restriction of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractCollection.Get"); + scope.Start(); + try + { + var response = await _policyRestrictionContractPolicyRestrictionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyRestrictionId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PolicyRestrictionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy restriction of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractCollection.Get"); + scope.Start(); + try + { + var response = _policyRestrictionContractPolicyRestrictionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyRestrictionId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PolicyRestrictionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all policy restrictions of API Management services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions + /// + /// + /// Operation Id + /// PolicyRestriction_ListByService + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _policyRestrictionContractPolicyRestrictionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _policyRestrictionContractPolicyRestrictionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PolicyRestrictionContractResource(Client, PolicyRestrictionContractData.DeserializePolicyRestrictionContractData(e)), _policyRestrictionContractPolicyRestrictionClientDiagnostics, Pipeline, "PolicyRestrictionContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all policy restrictions of API Management services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions + /// + /// + /// Operation Id + /// PolicyRestriction_ListByService + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _policyRestrictionContractPolicyRestrictionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _policyRestrictionContractPolicyRestrictionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PolicyRestrictionContractResource(Client, PolicyRestrictionContractData.DeserializePolicyRestrictionContractData(e)), _policyRestrictionContractPolicyRestrictionClientDiagnostics, Pipeline, "PolicyRestrictionContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractCollection.Exists"); + scope.Start(); + try + { + var response = await _policyRestrictionContractPolicyRestrictionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyRestrictionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractCollection.Exists"); + scope.Start(); + try + { + var response = _policyRestrictionContractPolicyRestrictionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyRestrictionId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _policyRestrictionContractPolicyRestrictionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyRestrictionId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyRestrictionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = _policyRestrictionContractPolicyRestrictionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyRestrictionId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PolicyRestrictionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyRestrictionContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyRestrictionContractData.cs new file mode 100644 index 000000000000..b8dc37470089 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyRestrictionContractData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the PolicyRestrictionContract data model. + /// Policy restriction contract details. + /// + public partial class PolicyRestrictionContractData : ResourceData + { + /// Initializes a new instance of . + public PolicyRestrictionContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Path to the policy document. + /// Indicates if base policy should be enforced for the policy document. + internal PolicyRestrictionContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, PolicyRestrictionRequireBase? requireBase) : base(id, name, resourceType, systemData) + { + Scope = scope; + RequireBase = requireBase; + } + + /// Path to the policy document. + public string Scope { get; set; } + /// Indicates if base policy should be enforced for the policy document. + public PolicyRestrictionRequireBase? RequireBase { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyRestrictionContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyRestrictionContractResource.cs new file mode 100644 index 000000000000..98f2baae0029 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyRestrictionContractResource.cs @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a PolicyRestrictionContract along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetPolicyRestrictionContractResource method. + /// Otherwise you can get one from its parent resource using the GetPolicyRestrictionContract method. + /// + public partial class PolicyRestrictionContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The policyRestrictionId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _policyRestrictionContractPolicyRestrictionClientDiagnostics; + private readonly PolicyRestrictionRestOperations _policyRestrictionContractPolicyRestrictionRestClient; + private readonly PolicyRestrictionContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/policyRestrictions"; + + /// Initializes a new instance of the class for mocking. + protected PolicyRestrictionContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PolicyRestrictionContractResource(ArmClient client, PolicyRestrictionContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal PolicyRestrictionContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _policyRestrictionContractPolicyRestrictionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string policyRestrictionContractPolicyRestrictionApiVersion); + _policyRestrictionContractPolicyRestrictionRestClient = new PolicyRestrictionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, policyRestrictionContractPolicyRestrictionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyRestrictionContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy restriction of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractResource.Get"); + scope.Start(); + try + { + var response = await _policyRestrictionContractPolicyRestrictionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PolicyRestrictionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy restriction of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractResource.Get"); + scope.Start(); + try + { + var response = _policyRestrictionContractPolicyRestrictionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PolicyRestrictionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy restriction configuration of the Api Management Service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractResource.Delete"); + scope.Start(); + try + { + var response = await _policyRestrictionContractPolicyRestrictionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy restriction configuration of the Api Management Service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractResource.Delete"); + scope.Start(); + try + { + var response = _policyRestrictionContractPolicyRestrictionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the policy restriction configuration of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The policy restriction to apply. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, PolicyRestrictionContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractResource.Update"); + scope.Start(); + try + { + var response = await _policyRestrictionContractPolicyRestrictionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PolicyRestrictionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the policy restriction configuration of the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The policy restriction to apply. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, PolicyRestrictionContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractResource.Update"); + scope.Start(); + try + { + var response = _policyRestrictionContractPolicyRestrictionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); + return Response.FromValue(new PolicyRestrictionContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the policy restriction in the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _policyRestrictionContractPolicyRestrictionRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the policy restriction in the Api Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId} + /// + /// + /// Operation Id + /// PolicyRestriction_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _policyRestrictionContractPolicyRestrictionClientDiagnostics.CreateScope("PolicyRestrictionContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = _policyRestrictionContractPolicyRestrictionRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractCollection.cs new file mode 100644 index 000000000000..b5436df2b15a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractCollection.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetPortalConfigContracts method from an instance of . + /// + public partial class PortalConfigContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _portalConfigContractPortalConfigClientDiagnostics; + private readonly PortalConfigRestOperations _portalConfigContractPortalConfigRestClient; + + /// Initializes a new instance of the class for mocking. + protected PortalConfigContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal PortalConfigContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _portalConfigContractPortalConfigClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", PortalConfigContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PortalConfigContractResource.ResourceType, out string portalConfigContractPortalConfigApiVersion); + _portalConfigContractPortalConfigRestClient = new PortalConfigRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, portalConfigContractPortalConfigApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Create or update the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Portal configuration identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, ifMatch, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new PortalConfigContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Portal configuration identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, ifMatch, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new PortalConfigContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.Get"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.Get"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the developer portal configurations. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs + /// + /// + /// Operation Id + /// PortalConfig_ListByService + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _portalConfigContractPortalConfigRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _portalConfigContractPortalConfigRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PortalConfigContractResource(Client, PortalConfigContractData.DeserializePortalConfigContractData(e)), _portalConfigContractPortalConfigClientDiagnostics, Pipeline, "PortalConfigContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the developer portal configurations. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs + /// + /// + /// Operation Id + /// PortalConfig_ListByService + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _portalConfigContractPortalConfigRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _portalConfigContractPortalConfigRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PortalConfigContractResource(Client, PortalConfigContractData.DeserializePortalConfigContractData(e)), _portalConfigContractPortalConfigClientDiagnostics, Pipeline, "PortalConfigContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.Exists"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.Exists"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractData.cs new file mode 100644 index 000000000000..3a2cb858b41a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractData.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the PortalConfigContract data model. + /// The developer portal configuration contract. + /// + public partial class PortalConfigContractData : ResourceData + { + /// Initializes a new instance of . + public PortalConfigContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Enable or disable Basic authentication method. + /// + /// + /// The developer portal delegation settings. + /// The developer portal Cross-Origin Resource Sharing (CORS) settings. + /// The developer portal Content Security Policy (CSP) settings. + internal PortalConfigContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? enableBasicAuth, PortalConfigPropertiesSignin signin, PortalConfigPropertiesSignup signup, PortalConfigDelegationProperties delegation, PortalConfigCorsProperties cors, PortalConfigCspProperties csp) : base(id, name, resourceType, systemData) + { + EnableBasicAuth = enableBasicAuth; + Signin = signin; + Signup = signup; + Delegation = delegation; + Cors = cors; + Csp = csp; + } + + /// Enable or disable Basic authentication method. + public bool? EnableBasicAuth { get; set; } + /// Gets or sets the signin. + internal PortalConfigPropertiesSignin Signin { get; set; } + /// Redirect anonymous users to the sign-in page. + public bool? Require + { + get => Signin is null ? default : Signin.Require; + set + { + if (Signin is null) + Signin = new PortalConfigPropertiesSignin(); + Signin.Require = value; + } + } + + /// Gets or sets the signup. + internal PortalConfigPropertiesSignup Signup { get; set; } + /// Terms of service settings. + public PortalConfigTermsOfServiceProperties SignupTermsOfService + { + get => Signup is null ? default : Signup.TermsOfService; + set + { + if (Signup is null) + Signup = new PortalConfigPropertiesSignup(); + Signup.TermsOfService = value; + } + } + + /// The developer portal delegation settings. + public PortalConfigDelegationProperties Delegation { get; set; } + /// The developer portal Cross-Origin Resource Sharing (CORS) settings. + internal PortalConfigCorsProperties Cors { get; set; } + /// Allowed origins, e.g. `https://trusted.com`. + public IList CorsAllowedOrigins + { + get + { + if (Cors is null) + Cors = new PortalConfigCorsProperties(); + return Cors.AllowedOrigins; + } + } + + /// The developer portal Content Security Policy (CSP) settings. + public PortalConfigCspProperties Csp { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractResource.cs new file mode 100644 index 000000000000..23bf0c3fd5cd --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractResource.cs @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a PortalConfigContract along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetPortalConfigContractResource method. + /// Otherwise you can get one from its parent resource using the GetPortalConfigContract method. + /// + public partial class PortalConfigContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The portalConfigId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _portalConfigContractPortalConfigClientDiagnostics; + private readonly PortalConfigRestOperations _portalConfigContractPortalConfigRestClient; + private readonly PortalConfigContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/portalconfigs"; + + /// Initializes a new instance of the class for mocking. + protected PortalConfigContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PortalConfigContractResource(ArmClient client, PortalConfigContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal PortalConfigContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _portalConfigContractPortalConfigClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string portalConfigContractPortalConfigApiVersion); + _portalConfigContractPortalConfigRestClient = new PortalConfigRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, portalConfigContractPortalConfigApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PortalConfigContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.Get"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.Get"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.Update"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.Update"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductApiLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductApiLinkContractData.cs new file mode 100644 index 000000000000..b830ac742a90 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductApiLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the ProductApiLinkContract data model. + /// Product-API link details. + /// + public partial class ProductApiLinkContractData : ResourceData + { + /// Initializes a new instance of . + public ProductApiLinkContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of an API. + internal ProductApiLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string apiId) : base(id, name, resourceType, systemData) + { + ApiId = apiId; + } + + /// Full resource Id of an API. + public string ApiId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductGroupLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductGroupLinkContractData.cs new file mode 100644 index 000000000000..8cdf5e8749a8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductGroupLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the ProductGroupLinkContract data model. + /// Product-group link details. + /// + public partial class ProductGroupLinkContractData : ResourceData + { + /// Initializes a new instance of . + public ProductGroupLinkContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of a group. + internal ProductGroupLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId) : base(id, name, resourceType, systemData) + { + GroupId = groupId; + } + + /// Full resource Id of a group. + public string GroupId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractCollection.cs new file mode 100644 index 000000000000..6eae51060411 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetResolverContracts method from an instance of . + /// + public partial class ResolverContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _resolverContractGraphQLApiResolverClientDiagnostics; + private readonly GraphQLApiResolverRestOperations _resolverContractGraphQLApiResolverRestClient; + + /// Initializes a new instance of the class for mocking. + protected ResolverContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ResolverContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _resolverContractGraphQLApiResolverClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResolverContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResolverContractResource.ResourceType, out string resolverContractGraphQLApiResolverApiVersion); + _resolverContractGraphQLApiResolverRestClient = new GraphQLApiResolverRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, resolverContractGraphQLApiResolverApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new resolver in the GraphQL API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string resolverId, ResolverContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ResolverContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new resolver in the GraphQL API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string resolverId, ResolverContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ResolverContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.Get"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.Get"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the resolvers for the specified GraphQL API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers + /// + /// + /// Operation Id + /// GraphQLApiResolver_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _resolverContractGraphQLApiResolverRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resolverContractGraphQLApiResolverRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResolverContractResource(Client, ResolverContractData.DeserializeResolverContractData(e)), _resolverContractGraphQLApiResolverClientDiagnostics, Pipeline, "ResolverContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the resolvers for the specified GraphQL API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers + /// + /// + /// Operation Id + /// GraphQLApiResolver_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _resolverContractGraphQLApiResolverRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resolverContractGraphQLApiResolverRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResolverContractResource(Client, ResolverContractData.DeserializeResolverContractData(e)), _resolverContractGraphQLApiResolverClientDiagnostics, Pipeline, "ResolverContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.Exists"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.Exists"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractData.cs new file mode 100644 index 000000000000..e6ae81c2d117 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractData.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the ResolverContract data model. + /// GraphQL API Resolver details. + /// + public partial class ResolverContractData : ResourceData + { + /// Initializes a new instance of . + public ResolverContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resolver Name. + /// Path is type/field being resolved. + /// Description of the resolver. May include HTML formatting tags. + internal ResolverContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string path, string description) : base(id, name, resourceType, systemData) + { + DisplayName = displayName; + Path = path; + Description = description; + } + + /// Resolver Name. + public string DisplayName { get; set; } + /// Path is type/field being resolved. + public string Path { get; set; } + /// Description of the resolver. May include HTML formatting tags. + public string Description { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractResource.cs new file mode 100644 index 000000000000..e662d88899bb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractResource.cs @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ResolverContract along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetResolverContractResource method. + /// Otherwise you can get one from its parent resource using the GetResolverContract method. + /// + public partial class ResolverContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The resolverId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _resolverContractGraphQLApiResolverClientDiagnostics; + private readonly GraphQLApiResolverRestOperations _resolverContractGraphQLApiResolverRestClient; + private readonly ResolverContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis/resolvers"; + + /// Initializes a new instance of the class for mocking. + protected ResolverContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ResolverContractResource(ArmClient client, ResolverContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ResolverContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _resolverContractGraphQLApiResolverClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string resolverContractGraphQLApiResolverApiVersion); + _resolverContractGraphQLApiResolverRestClient = new GraphQLApiResolverRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, resolverContractGraphQLApiResolverApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ResolverContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceApiResolverPolicyResources in the ResolverContract. + /// An object representing collection of ServiceApiResolverPolicyResources and their operations over a ServiceApiResolverPolicyResource. + public virtual ServiceApiResolverPolicyCollection GetServiceApiResolverPolicies() + { + return GetCachedClient(client => new ServiceApiResolverPolicyCollection(client, Id)); + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceApiResolverPolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceApiResolverPolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceApiResolverPolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceApiResolverPolicies().Get(policyId, format, cancellationToken); + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Get"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Get"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified resolver in the GraphQL API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Delete"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified resolver in the GraphQL API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Delete"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the resolver in the GraphQL API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// GraphQL API Resolver Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ResolverContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Update"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the resolver in the GraphQL API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// GraphQL API Resolver Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ResolverContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Update"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AllPoliciesRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AllPoliciesRestOperations.cs new file mode 100644 index 000000000000..253f1755d6cb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AllPoliciesRestOperations.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class AllPoliciesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AllPoliciesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AllPoliciesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/allPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Status of all policies of API Management services. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AllPoliciesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AllPoliciesListResult.DeserializeAllPoliciesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Status of all policies of API Management services. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AllPoliciesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AllPoliciesListResult.DeserializeAllPoliciesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Status of all policies of API Management services. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AllPoliciesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AllPoliciesListResult.DeserializeAllPoliciesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Status of all policies of API Management services. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AllPoliciesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AllPoliciesListResult.DeserializeAllPoliciesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs index db864985bfcc..3cab71b8ae98 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs @@ -33,7 +33,7 @@ public ApiDiagnosticRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all diagnostics of an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsync(string subs } /// Lists all diagnostics of an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Diagnostic for an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -400,8 +400,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates a new Diagnostic for an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -466,8 +466,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -502,8 +502,8 @@ public async Task> UpdateAsync(string subscript } /// Updates the details of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -563,8 +563,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified Diagnostic from an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -593,8 +593,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified Diagnostic from an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -638,8 +638,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all diagnostics of an API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -674,8 +674,8 @@ public async Task> ListByServiceNextPageAsync(str /// Lists all diagnostics of an API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs index 64f94382dd4e..9a08589cac65 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs @@ -33,7 +33,7 @@ public ApiIssueAttachmentRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all attachments for the Issue associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -111,8 +111,8 @@ public async Task> ListByServiceAsync(string } /// Lists all attachments for the Issue associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -173,8 +173,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -211,8 +211,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -275,8 +275,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the issue Attachment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -312,8 +312,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the issue Attachment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -383,8 +383,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Attachment for the Issue in an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -422,8 +422,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates a new Attachment for the Issue in an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -488,8 +488,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified comment from an Issue. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -520,8 +520,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified comment from an Issue. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -567,8 +567,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all attachments for the Issue associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -605,8 +605,8 @@ public async Task> ListByServiceNextPageAsyn /// Lists all attachments for the Issue associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs index f03fe5ed7a03..ef7274b66d47 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs @@ -33,7 +33,7 @@ public ApiIssueCommentRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all comments for the Issue associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -111,8 +111,8 @@ public async Task> ListByServiceAsync(string su } /// Lists all comments for the Issue associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -173,8 +173,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -211,8 +211,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -275,8 +275,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the issue Comment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -312,8 +312,8 @@ public async Task> GetAsync(string subscriptionId, } /// Gets the details of the issue Comment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -383,8 +383,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Comment for the Issue in an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -422,8 +422,8 @@ public async Task> CreateOrUpdateAsync(string subs } /// Creates a new Comment for the Issue in an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -488,8 +488,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified comment from an Issue. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -520,8 +520,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified comment from an Issue. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -567,8 +567,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all comments for the Issue associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -605,8 +605,8 @@ public async Task> ListByServiceNextPageAsync(s /// Lists all comments for the Issue associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs index f6ead96eb010..fcc6ce3ea841 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs @@ -33,7 +33,7 @@ public ApiIssueRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -77,8 +77,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all issues associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. @@ -112,8 +112,8 @@ public async Task> ListByServiceAsync(string subscript } /// Lists all issues associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. @@ -171,8 +171,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Issue for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -207,8 +207,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Issue for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -271,8 +271,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Issue for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -307,8 +307,8 @@ public async Task> GetAsync(string subscriptionId, s } /// Gets the details of the Issue for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -375,8 +375,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Issue for an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -412,8 +412,8 @@ public async Task> CreateOrUpdateAsync(string subscr } /// Creates a new Issue for an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -478,8 +478,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing issue for an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -514,8 +514,8 @@ public async Task> UpdateAsync(string subscriptionId } /// Updates an existing issue for an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -575,8 +575,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified Issue from an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -605,8 +605,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified Issue from an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -650,8 +650,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all issues associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. @@ -687,8 +687,8 @@ public async Task> ListByServiceNextPageAsync(string n /// Lists all issues associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs index 2a96fc8ab6a7..83d933e24d98 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs @@ -32,7 +32,7 @@ public ApiManagementRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -62,8 +62,8 @@ internal HttpMessage CreatePerformConnectivityCheckAsyncRequest(string subscript } /// Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Connectivity Check request parameters. /// The cancellation token to use. @@ -89,8 +89,8 @@ public async Task PerformConnectivityCheckAsyncAsync(string subscripti } /// Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Connectivity Check request parameters. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs index c54b5fe7924d..202ac2e8b7d3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs @@ -33,7 +33,7 @@ public ApiManagementServiceRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateRestoreRequest(string subscriptionId, string resource } /// Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the Restore API Management service from backup operation. /// The cancellation token to use. @@ -90,8 +90,8 @@ public async Task RestoreAsync(string subscriptionId, string resourceG } /// Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the Restore API Management service from backup operation. /// The cancellation token to use. @@ -142,8 +142,8 @@ internal HttpMessage CreateBackupRequest(string subscriptionId, string resourceG } /// Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the ApiManagementService_Backup operation. /// The cancellation token to use. @@ -169,8 +169,8 @@ public async Task BackupAsync(string subscriptionId, string resourceGr } /// Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the ApiManagementService_Backup operation. /// The cancellation token to use. @@ -220,8 +220,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the CreateOrUpdate API Management service operation. /// The cancellation token to use. @@ -240,7 +240,6 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -248,8 +247,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the CreateOrUpdate API Management service operation. /// The cancellation token to use. @@ -268,7 +267,6 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -300,8 +298,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the CreateOrUpdate API Management service operation. /// The cancellation token to use. @@ -327,8 +325,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates an existing API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the CreateOrUpdate API Management service operation. /// The cancellation token to use. @@ -374,8 +372,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets an API Management service resource description. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -405,8 +403,8 @@ public async Task> GetAsync(string subscripti } /// Gets an API Management service resource description. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -456,8 +454,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes an existing API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -482,8 +480,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes an existing API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -507,6 +505,86 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s } } + internal HttpMessage CreateMigrateToStv2Request(string subscriptionId, string resourceGroupName, string serviceName, MigrateToStv2Contract migrateToStv2Contract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/migrateToStv2", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (migrateToStv2Contract != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(migrateToStv2Contract); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Upgrades an API Management service to the Stv2 platform. For details refer to https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation and could take several minutes to complete. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Optional parameters supplied to migrate service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task MigrateToStv2Async(string subscriptionId, string resourceGroupName, string serviceName, MigrateToStv2Contract migrateToStv2Contract = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateMigrateToStv2Request(subscriptionId, resourceGroupName, serviceName, migrateToStv2Contract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Upgrades an API Management service to the Stv2 platform. For details refer to https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation and could take several minutes to complete. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Optional parameters supplied to migrate service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response MigrateToStv2(string subscriptionId, string resourceGroupName, string serviceName, MigrateToStv2Contract migrateToStv2Contract = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateMigrateToStv2Request(subscriptionId, resourceGroupName, serviceName, migrateToStv2Contract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); @@ -527,8 +605,8 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str } /// List all API Management services within a resource group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -554,8 +632,8 @@ public async Task> ListByResourceGroupA } /// List all API Management services within a resource group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -598,7 +676,7 @@ internal HttpMessage CreateListRequest(string subscriptionId) } /// Lists all API Management services within an Azure subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -623,7 +701,7 @@ public async Task> ListAsync(string sub } /// Lists all API Management services within an Azure subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -669,8 +747,8 @@ internal HttpMessage CreateGetSsoTokenRequest(string subscriptionId, string reso } /// Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -698,8 +776,8 @@ public async Task> GetSsoTokenAs } /// Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -748,7 +826,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, A } /// Checks availability and correctness of a name for an API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// Parameters supplied to the CheckNameAvailability operation. /// The cancellation token to use. /// or is null. @@ -775,7 +853,7 @@ public async Task> CheckNam } /// Checks availability and correctness of a name for an API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// Parameters supplied to the CheckNameAvailability operation. /// The cancellation token to use. /// or is null. @@ -819,7 +897,7 @@ internal HttpMessage CreateGetDomainOwnershipIdentifierRequest(string subscripti } /// Get the custom domain ownership identifier for an API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -844,7 +922,7 @@ public async Task Get the custom domain ownership identifier for an API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -897,8 +975,8 @@ internal HttpMessage CreateApplyNetworkConfigurationUpdatesRequest(string subscr } /// Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. /// The cancellation token to use. @@ -923,8 +1001,8 @@ public async Task ApplyNetworkConfigurationUpdatesAsync(string subscri } /// Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. /// The cancellation token to use. @@ -964,8 +1042,8 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// List all API Management services within a resource group. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. /// or is an empty string, and was expected to be non-empty. @@ -993,8 +1071,8 @@ public async Task> ListByResourceGroupN /// List all API Management services within a resource group. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. /// or is an empty string, and was expected to be non-empty. @@ -1036,7 +1114,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists all API Management services within an Azure subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -1063,7 +1141,7 @@ public async Task> ListNextPageAsync(st /// Lists all API Management services within an Azure subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceSkusRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceSkusRestOperations.cs index d2814c6dcfeb..e7dabb86d3c9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceSkusRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceSkusRestOperations.cs @@ -33,7 +33,7 @@ public ApiManagementServiceSkusRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListAvailableServiceSkusRequest(string subscriptionId } /// Gets all available SKU for a given API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListAvailableServiceSkusAsync(st } /// Gets all available SKU for a given API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -132,8 +132,8 @@ internal HttpMessage CreateListAvailableServiceSkusNextPageRequest(string nextLi /// Gets all available SKU for a given API Management service. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. @@ -163,8 +163,8 @@ public async Task> ListAvailableServiceSkusNextPage /// Gets all available SKU for a given API Management service. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementSkusRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementSkusRestOperations.cs index 3873ec1e789e..e70171659eaf 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementSkusRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementSkusRestOperations.cs @@ -33,7 +33,7 @@ public ApiManagementSkusRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -55,7 +55,7 @@ internal HttpMessage CreateListRequest(string subscriptionId) } /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -80,7 +80,7 @@ public async Task> ListAsync(string subscripti } /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -120,7 +120,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -147,7 +147,7 @@ public async Task> ListNextPageAsync(string ne /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs index b536472bf818..6d2448c19a70 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs @@ -33,7 +33,7 @@ public ApiOperationPolicyRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateListByOperationRequest(string subscriptionId, string } /// Get the list of policy configuration at the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -96,8 +96,8 @@ public async Task> ListByOperationAsync(string subscr } /// Get the list of policy configuration at the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -155,8 +155,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -192,8 +192,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -259,8 +259,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the policy configuration at the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscriptionId, } /// Get the policy configuration at the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -367,8 +367,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates policy configuration for the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -405,8 +405,8 @@ public async Task> CreateOrUpdateAsync(string subsc } /// Creates or updates policy configuration for the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -470,8 +470,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the policy configuration at the Api Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -501,8 +501,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the policy configuration at the Api Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs index c4d7dea2c4ec..ac4f148d89fe 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs @@ -33,7 +33,7 @@ public ApiOperationRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -77,8 +77,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Lists a collection of the operations for the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -112,8 +112,8 @@ public async Task> ListByApiAsync(string subscript } /// Lists a collection of the operations for the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -171,8 +171,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the API operation specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -207,8 +207,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the API operation specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -267,8 +267,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the API Operation specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -302,8 +302,8 @@ public async Task> GetAsync(string subscriptionId, st } /// Gets the details of the API Operation specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -369,8 +369,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new operation in the API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -406,8 +406,8 @@ public async Task> CreateOrUpdateAsync(string subscri } /// Creates a new operation in the API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -442,7 +442,7 @@ public Response CreateOrUpdate(string subscriptionId, string r } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, ApiOperationPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -465,33 +465,33 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(operationUpdateContract); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the details of the operation in the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// API Operation Update parameters. + /// API Operation Update parameters. /// The cancellation token to use. - /// , , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, ApiOperationPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, operationId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, operationId, ifMatch, operationUpdateContract); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -508,26 +508,26 @@ public async Task> UpdateAsync(string subscriptionId, } /// Updates the details of the operation in the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// API Operation Update parameters. + /// API Operation Update parameters. /// The cancellation token to use. - /// , , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, ApiOperationPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, operationId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, operationId, ifMatch, operationUpdateContract); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -569,8 +569,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified operation in the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -599,8 +599,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified operation in the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -644,8 +644,8 @@ internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subs /// Lists a collection of the operations for the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -681,8 +681,8 @@ public async Task> ListByApiNextPageAsync(string n /// Lists a collection of the operations for the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs index 586fcd8f031d..9953f1e00b30 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs @@ -33,7 +33,7 @@ public ApiPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Get the policy configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The cancellation token to use. @@ -92,8 +92,8 @@ public async Task> ListByApiAsync(string subscription } /// Get the policy configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The cancellation token to use. @@ -147,8 +147,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the API policy specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The identifier of the Policy. @@ -182,8 +182,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the API policy specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The identifier of the Policy. @@ -245,8 +245,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the policy configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The identifier of the Policy. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscriptionId, } /// Get the policy configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The identifier of the Policy. @@ -347,8 +347,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates policy configuration for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The identifier of the Policy. @@ -383,8 +383,8 @@ public async Task> CreateOrUpdateAsync(string subsc } /// Creates or updates policy configuration for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The identifier of the Policy. @@ -444,8 +444,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the policy configuration at the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The identifier of the Policy. @@ -473,8 +473,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the policy configuration at the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The identifier of the Policy. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiProductRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiProductRestOperations.cs index 9d86647df7d0..57278cc3006b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiProductRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiProductRestOperations.cs @@ -33,7 +33,7 @@ public ApiProductRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByApisRequest(string subscriptionId, string resou } /// Lists all Products, which the API is part of. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByApisAsync(string subscripti } /// Lists all Products, which the API is part of. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -156,8 +156,8 @@ internal HttpMessage CreateListByApisNextPageRequest(string nextLink, string sub /// Lists all Products, which the API is part of. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -192,8 +192,8 @@ public async Task> ListByApisNextPageAsync(string ne /// Lists all Products, which the API is part of. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs index 744d7fe91a3b..01c66ed692da 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs @@ -33,7 +33,7 @@ public ApiReleaseRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsync(string subs } /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Returns the etag of an API release. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Returns the etag of an API release. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Returns the details of an API release. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscriptionId, stri } /// Returns the details of an API release. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Release for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -400,8 +400,8 @@ public async Task> CreateOrUpdateAsync(string subscript } /// Creates a new Release for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -466,8 +466,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the release of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -502,8 +502,8 @@ public async Task> UpdateAsync(string subscriptionId, s } /// Updates the details of the release of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -563,8 +563,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified release in the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -593,8 +593,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified release in the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -638,8 +638,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -674,8 +674,8 @@ public async Task> ListByServiceNextPageAsync(str /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs index 3acb6eb34be0..25d7188b7907 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs @@ -33,7 +33,7 @@ public ApiRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoi { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -79,8 +79,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all APIs of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. /// Number of records to return. @@ -113,8 +113,8 @@ public async Task> ListByServiceAsync(string subscriptio } /// Lists all APIs of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. /// Number of records to return. @@ -169,8 +169,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The cancellation token to use. @@ -203,8 +203,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The cancellation token to use. @@ -259,8 +259,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The cancellation token to use. @@ -292,8 +292,8 @@ public async Task> GetAsync(string subscriptionId, string reso } /// Gets the details of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The cancellation token to use. @@ -324,7 +324,7 @@ public Response Get(string subscriptionId, string resourceGroupName, st } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -347,38 +347,37 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiCreateOrUpdateParameter); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates new or updates existing specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. - /// Create or update parameters. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, apiCreateOrUpdateParameter, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -386,37 +385,36 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates new or updates existing specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. - /// Create or update parameters. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, apiCreateOrUpdateParameter, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -437,31 +435,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(apiUpdateContract); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// API Update Contract parameters. + /// API Update Contract parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, apiUpdateContract); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -478,24 +476,24 @@ public async Task> UpdateAsync(string subscriptionId, string r } /// Updates the specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// API Update Contract parameters. + /// API Update Contract parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, apiUpdateContract); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -539,8 +537,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -559,7 +557,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: + case 202: case 204: return message.Response; default: @@ -568,8 +566,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -588,7 +586,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: + case 202: case 204: return message.Response; default: @@ -634,8 +632,8 @@ internal HttpMessage CreateListByTagsRequest(string subscriptionId, string resou } /// Lists a collection of apis associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -667,8 +665,8 @@ public async Task> ListByTagsAsync(string subscr } /// Lists a collection of apis associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -715,8 +713,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all APIs of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. /// Number of records to return. @@ -751,8 +749,8 @@ public async Task> ListByServiceNextPageAsync(string nex /// Lists all APIs of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. /// Number of records to return. @@ -801,8 +799,8 @@ internal HttpMessage CreateListByTagsNextPageRequest(string nextLink, string sub /// Lists a collection of apis associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -836,8 +834,8 @@ public async Task> ListByTagsNextPageAsync(strin /// Lists a collection of apis associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRevisionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRevisionRestOperations.cs index f7273137f849..f8c6968c749f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRevisionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRevisionRestOperations.cs @@ -33,7 +33,7 @@ public ApiRevisionRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all revisions of an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists all revisions of an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -156,8 +156,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all revisions of an API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -192,8 +192,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists all revisions of an API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs index 6146360a2007..ff67ecd688a9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs @@ -33,7 +33,7 @@ public ApiSchemaRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Get the schema configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByApiAsync(string subscription } /// Get the schema configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the schema configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscriptionId, strin } /// Get the schema configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates schema configuration for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -388,7 +388,6 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -396,8 +395,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates schema configuration for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -421,7 +420,6 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -458,8 +456,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the schema configuration at the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -489,8 +487,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the schema configuration at the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -535,8 +533,8 @@ internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subs /// Get the schema configuration at the API level. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -571,8 +569,8 @@ public async Task> ListByApiNextPageAsync(string next /// Get the schema configuration at the API level. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs index 204b74a12868..755069881998 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs @@ -33,7 +33,7 @@ public ApiTagDescriptionRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsync(string } /// Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get Tag description in scope of API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscriptionI } /// Get Tag description in scope of API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create/Update tag description in scope of the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -400,8 +400,8 @@ public async Task> CreateOrUpdateAsync(string su } /// Create/Update tag description in scope of the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -462,8 +462,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Delete tag description for the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -492,8 +492,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Delete tag description for the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -537,8 +537,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -573,8 +573,8 @@ public async Task> ListByServiceNextPageAsync /// Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs index e78081ceb08e..3575547b20c0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs @@ -33,7 +33,7 @@ public ApiVersionSetRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of API Version Sets in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string s } /// Lists a collection of API Version Sets in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Api Version Set specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscriptionId, s } /// Gets the details of the Api Version Set specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a Api Version Set. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdateAsync(string subscr } /// Creates or Updates a Api Version Set. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -412,7 +412,7 @@ public Response CreateOrUpdate(string subscriptionId, string } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -433,31 +433,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(apiVersionSetUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the details of the Api VersionSet specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, versionSetId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, versionSetId, ifMatch, apiVersionSetUpdateParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -474,24 +474,24 @@ public async Task> UpdateAsync(string subscriptionId } /// Updates the details of the Api VersionSet specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, versionSetId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, versionSetId, ifMatch, apiVersionSetUpdateParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific Api Version Set. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific Api Version Set. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -602,8 +602,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of API Version Sets in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. /// Number of records to return. @@ -636,8 +636,8 @@ public async Task> ListByServiceNextPageAsync( /// Lists a collection of API Version Sets in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiWikiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiWikiRestOperations.cs new file mode 100644 index 000000000000..c45de65b4ac7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiWikiRestOperations.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class ApiWikiRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ApiWikiRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ApiWikiRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WikiContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WikiContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, WikiContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new Wiki for an API or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new Wiki for an API or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, WikiUpdateContract wikiUpdateContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(wikiUpdateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Wiki Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, wikiUpdateContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Wiki Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, wikiUpdateContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified Wiki from an API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified Wiki from an API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationAccessPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationAccessPolicyRestOperations.cs new file mode 100644 index 000000000000..db044d8fcc5c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationAccessPolicyRestOperations.cs @@ -0,0 +1,542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class AuthorizationAccessPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AuthorizationAccessPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AuthorizationAccessPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByAuthorizationRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/accessPolicies", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization access policy defined within a authorization. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAuthorizationAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateListByAuthorizationRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationAccessPolicyListResult.DeserializeAuthorizationAccessPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization access policy defined within a authorization. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByAuthorization(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateListByAuthorizationRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationAccessPolicyListResult.DeserializeAuthorizationAccessPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/accessPolicies/", false); + uri.AppendPath(authorizationAccessPolicyId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the authorization access policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationAccessPolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the authorization access policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationAccessPolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/accessPolicies/", false); + uri.AppendPath(authorizationAccessPolicyId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates Authorization Access Policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationAccessPolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates Authorization Access Policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationAccessPolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/accessPolicies/", false); + uri.AppendPath(authorizationAccessPolicyId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific access policy from the Authorization. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific access policy from the Authorization. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByAuthorizationNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization access policy defined within a authorization. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAuthorizationNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateListByAuthorizationNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationAccessPolicyListResult.DeserializeAuthorizationAccessPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization access policy defined within a authorization. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByAuthorizationNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateListByAuthorizationNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationAccessPolicyListResult.DeserializeAuthorizationAccessPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationLoginLinksRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationLoginLinksRestOperations.cs new file mode 100644 index 000000000000..e9aee9c7b539 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationLoginLinksRestOperations.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class AuthorizationLoginLinksRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AuthorizationLoginLinksRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AuthorizationLoginLinksRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreatePostRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationLoginRequestContract authorizationLoginRequestContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/getLoginLinks", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(authorizationLoginRequestContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Gets authorization login links. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> PostAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationLoginRequestContract authorizationLoginRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(authorizationLoginRequestContract, nameof(authorizationLoginRequestContract)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationLoginRequestContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationLoginResponseContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationLoginResponseContract.DeserializeAuthorizationLoginResponseContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets authorization login links. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Post(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationLoginRequestContract authorizationLoginRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(authorizationLoginRequestContract, nameof(authorizationLoginRequestContract)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationLoginRequestContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationLoginResponseContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationLoginResponseContract.DeserializeAuthorizationLoginResponseContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationProviderRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationProviderRestOperations.cs new file mode 100644 index 000000000000..6b1856c052a9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationProviderRestOperations.cs @@ -0,0 +1,486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class AuthorizationProviderRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AuthorizationProviderRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AuthorizationProviderRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization providers defined within a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationProviderListResult.DeserializeAuthorizationProviderListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization providers defined within a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationProviderListResult.DeserializeAuthorizationProviderListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the authorization provider specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationProviderContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the authorization provider specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationProviderContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates authorization provider. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationProviderContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates authorization provider. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationProviderContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific authorization provider from the API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific authorization provider from the API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization providers defined within a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationProviderListResult.DeserializeAuthorizationProviderListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization providers defined within a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationProviderListResult.DeserializeAuthorizationProviderListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationRestOperations.cs new file mode 100644 index 000000000000..b437b27d73c9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationRestOperations.cs @@ -0,0 +1,603 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class AuthorizationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AuthorizationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AuthorizationRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByAuthorizationProviderRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization providers defined within a authorization provider. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAuthorizationProviderAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateListByAuthorizationProviderRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationListResult.DeserializeAuthorizationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization providers defined within a authorization provider. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByAuthorizationProvider(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateListByAuthorizationProviderRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationListResult.DeserializeAuthorizationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the authorization specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationContractData.DeserializeAuthorizationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the authorization specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationContractData.DeserializeAuthorizationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates authorization. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationContractData.DeserializeAuthorizationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates authorization. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationContractData.DeserializeAuthorizationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific Authorization from the Authorization provider. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific Authorization from the Authorization provider. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateConfirmConsentCodeRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/confirmConsentCode", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(authorizationConfirmConsentCodeRequestContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Confirm valid consent code to suppress Authorizations anti-phishing page. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task ConfirmConsentCodeAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(authorizationConfirmConsentCodeRequestContract, nameof(authorizationConfirmConsentCodeRequestContract)); + + using var message = CreateConfirmConsentCodeRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationConfirmConsentCodeRequestContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Confirm valid consent code to suppress Authorizations anti-phishing page. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ConfirmConsentCode(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(authorizationConfirmConsentCodeRequestContract, nameof(authorizationConfirmConsentCodeRequestContract)); + + using var message = CreateConfirmConsentCodeRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationConfirmConsentCodeRequestContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByAuthorizationProviderNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization providers defined within a authorization provider. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAuthorizationProviderNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateListByAuthorizationProviderNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, authorizationProviderId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationListResult.DeserializeAuthorizationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization providers defined within a authorization provider. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByAuthorizationProviderNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateListByAuthorizationProviderNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, authorizationProviderId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationListResult.DeserializeAuthorizationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs index f4beb4291e8c..1b36ad34f1c0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs @@ -33,7 +33,7 @@ public AuthorizationServerRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of authorization servers defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(st } /// Lists a collection of authorization servers defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the authorizationServer specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the authorizationServer specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the authorization server specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(strin } /// Gets the details of the authorization server specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates new authorization server or updates an existing authorization server. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// Create or update parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdate } /// Creates new authorization server or updates an existing authorization server. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// Create or update parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the authorization server specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -474,8 +474,8 @@ public async Task> UpdateAsync(st } /// Updates the details of the authorization server specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific authorization server instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific authorization server instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -610,8 +610,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the client secret details of the authorization server. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -641,8 +641,8 @@ public async Task> ListSecretsAsync } /// Gets the client secret details of the authorization server. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -687,8 +687,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of authorization servers defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -721,8 +721,8 @@ public async Task> ListByServiceNextPage /// Lists a collection of authorization servers defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs index d237bf27a89d..585eeaf3c1b3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs @@ -33,7 +33,7 @@ public BackendRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of backends in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subscri } /// Lists a collection of backends in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the backend specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the backend specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the backend specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscripti } /// Gets the details of the backend specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// Create parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or Updates a backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// Create parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -474,8 +474,8 @@ public async Task> UpdateAsync(string subscri } /// Updates an existing backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -616,9 +616,9 @@ internal HttpMessage CreateReconnectRequest(string subscriptionId, string resour return message; } - /// Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// Notifies the API Management gateway to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// Reconnect request parameters. @@ -643,9 +643,9 @@ public async Task ReconnectAsync(string subscriptionId, string resourc } } - /// Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// Notifies the API Management gateway to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// Reconnect request parameters. @@ -686,8 +686,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of backends in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -720,8 +720,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists a collection of backends in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs index dca89992c924..159c6280ff10 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs @@ -33,7 +33,7 @@ public CacheRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -67,8 +67,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of all external Caches in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -98,8 +98,8 @@ public async Task> ListByServiceAsync(string subscript } /// Lists a collection of all external Caches in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -151,8 +151,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. @@ -185,8 +185,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. @@ -241,8 +241,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. @@ -274,8 +274,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the Cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. @@ -337,8 +337,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates an External Cache to be used in Api Management instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// Create or Update parameters. @@ -372,8 +372,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates or updates an External Cache to be used in Api Management instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// Create or Update parameters. @@ -434,8 +434,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -468,8 +468,8 @@ public async Task> UpdateAsync(string subscript } /// Updates the details of the cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -525,8 +525,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific Cache. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -553,8 +553,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific Cache. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -596,8 +596,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of all external Caches in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -629,8 +629,8 @@ public async Task> ListByServiceNextPageAsync(string n /// Lists a collection of all external Caches in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs index 53723e58eb02..ce075ef8bfd2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs @@ -33,7 +33,7 @@ public CertificateRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of all certificates in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| expirationDate | filter | ge, le, eq, ne, gt, lt | |</br>. /// Number of records to return. @@ -108,8 +108,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists a collection of all certificates in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| expirationDate | filter | ge, le, eq, ne, gt, lt | |</br>. /// Number of records to return. @@ -163,8 +163,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the certificate specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -197,8 +197,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the certificate specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -253,8 +253,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the certificate specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -286,8 +286,8 @@ public async Task> GetAsync(string subscr } /// Gets the details of the certificate specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -349,8 +349,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates the certificate being used for authentication with the backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// Create or Update parameters. @@ -384,8 +384,8 @@ public async Task> CreateOrUpdateAsync(st } /// Creates or updates the certificate being used for authentication with the backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// Create or Update parameters. @@ -442,8 +442,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific certificate. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -470,8 +470,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific certificate. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -521,8 +521,8 @@ internal HttpMessage CreateRefreshSecretRequest(string subscriptionId, string re } /// From KeyVault, Refresh the certificate being used for authentication with the backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -552,8 +552,8 @@ public async Task> RefreshSecretAsync(str } /// From KeyVault, Refresh the certificate being used for authentication with the backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -598,8 +598,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of all certificates in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| expirationDate | filter | ge, le, eq, ne, gt, lt | |</br>. /// Number of records to return. @@ -633,8 +633,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists a collection of all certificates in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| expirationDate | filter | ge, le, eq, ne, gt, lt | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentItemRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentItemRestOperations.cs index 828fc970e848..c6283d46a531 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentItemRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentItemRestOperations.cs @@ -33,7 +33,7 @@ public ContentItemRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists developer portal's content items specified by the provided content type. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -92,8 +92,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists developer portal's content items specified by the provided content type. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -147,8 +147,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Returns the entity state (ETag) version of the developer portal's content item specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -183,8 +183,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Returns the entity state (ETag) version of the developer portal's content item specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -243,8 +243,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Returns the developer portal's content item specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -276,8 +276,8 @@ public async Task> GetAsync(string subscripti } /// Returns the developer portal's content item specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -308,7 +308,7 @@ public Response Get(string subscriptionId, string reso } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -332,29 +332,35 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Headers.Add("If-Match", ifMatch.Value); } request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiManagementContentItem); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates a new developer portal's content item specified by the provided content type. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); Argument.AssertNotNullOrEmpty(contentItemId, nameof(contentItemId)); + Argument.AssertNotNull(apiManagementContentItem, nameof(apiManagementContentItem)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, contentItemId, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, contentItemId, apiManagementContentItem, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -372,24 +378,26 @@ public async Task> CreateOrUpdateAsync(string } /// Creates a new developer portal's content item specified by the provided content type. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); Argument.AssertNotNullOrEmpty(contentItemId, nameof(contentItemId)); + Argument.AssertNotNull(apiManagementContentItem, nameof(apiManagementContentItem)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, contentItemId, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, contentItemId, apiManagementContentItem, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -432,8 +440,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Removes the specified developer portal's content item. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -462,8 +470,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Removes the specified developer portal's content item. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -507,8 +515,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists developer portal's content items specified by the provided content type. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -540,8 +548,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists developer portal's content items specified by the provided content type. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentTypeRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentTypeRestOperations.cs index 4a5c44eada19..372276751bda 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentTypeRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentTypeRestOperations.cs @@ -33,7 +33,7 @@ public ContentTypeRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -139,8 +139,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -170,8 +170,8 @@ public async Task> GetAsync(string subscripti } /// Gets the details of the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -200,7 +200,7 @@ public Response Get(string subscriptionId, string reso } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -222,27 +222,33 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Headers.Add("If-Match", ifMatch.Value); } request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiManagementContentType); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates or updates the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. Custom content types' identifiers need to start with the `c-` prefix. Built-in content types can't be modified. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); + Argument.AssertNotNull(apiManagementContentType, nameof(apiManagementContentType)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, apiManagementContentType, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -260,22 +266,24 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or updates the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. Custom content types' identifiers need to start with the `c-` prefix. Built-in content types can't be modified. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); + Argument.AssertNotNull(apiManagementContentType, nameof(apiManagementContentType)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, apiManagementContentType, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -316,8 +324,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Removes the specified developer portal's content type. Content types describe content items' properties, validation rules, and constraints. Built-in content types (with identifiers starting with the `c-` prefix) can't be removed. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -344,8 +352,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Removes the specified developer portal's content type. Content types describe content items' properties, validation rules, and constraints. Built-in content types (with identifiers starting with the `c-` prefix) can't be removed. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -387,8 +395,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. @@ -418,8 +426,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs index 3f057b998be4..eac9f402e59b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs @@ -33,7 +33,7 @@ public DelegationSettingsRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the DelegationSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -91,8 +91,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the DelegationSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -144,8 +144,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get Delegation Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -175,8 +175,8 @@ public async Task> GetAsync(s } /// Get Delegation Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -232,8 +232,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update Delegation settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. /// Update Delegation settings. @@ -259,8 +259,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update Delegation settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. /// Update Delegation settings. @@ -315,8 +315,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or Update Delegation settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -347,8 +347,8 @@ public async Task> CreateOrUp } /// Create or Update Delegation settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -400,8 +400,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the secret validation key of the DelegationSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -429,8 +429,8 @@ public async Task> ListSecretsAsync } /// Gets the secret validation key of the DelegationSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DeletedServicesRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DeletedServicesRestOperations.cs index 7191bf897c40..cd0e925cbcff 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DeletedServicesRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DeletedServicesRestOperations.cs @@ -33,7 +33,7 @@ public DeletedServicesRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -55,7 +55,7 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) } /// Lists all soft-deleted services available for undelete for the given subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -80,7 +80,7 @@ public async Task> ListBySubscriptionAsync(s } /// Lists all soft-deleted services available for undelete for the given subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -125,7 +125,7 @@ internal HttpMessage CreateGetByNameRequest(string subscriptionId, AzureLocation } /// Get soft-deleted Api Management Service by name. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. @@ -155,7 +155,7 @@ public async Task> GetByNameAsync(stri } /// Get soft-deleted Api Management Service by name. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. @@ -205,7 +205,7 @@ internal HttpMessage CreatePurgeRequest(string subscriptionId, AzureLocation loc } /// Purges Api Management Service (deletes it with no option to undelete). - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. @@ -230,7 +230,7 @@ public async Task PurgeAsync(string subscriptionId, AzureLocation loca } /// Purges Api Management Service (deletes it with no option to undelete). - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. @@ -270,7 +270,7 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// Lists all soft-deleted services available for undelete for the given subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -297,7 +297,7 @@ public async Task> ListBySubscriptionNextPag /// Lists all soft-deleted services available for undelete for the given subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs index 89bd396dc6ee..99c79a341df4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs @@ -33,7 +33,7 @@ public DiagnosticRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all diagnostics of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subs } /// Lists all diagnostics of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Diagnostic or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// Create parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates a new Diagnostic or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// Create parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -474,8 +474,8 @@ public async Task> UpdateAsync(string subscript } /// Updates the details of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified Diagnostic. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified Diagnostic. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -602,8 +602,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all diagnostics of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -636,8 +636,8 @@ public async Task> ListByServiceNextPageAsync(str /// Lists all diagnostics of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DocumentationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DocumentationRestOperations.cs new file mode 100644 index 000000000000..8a9c2307f7a1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DocumentationRestOperations.cs @@ -0,0 +1,671 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class DocumentationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DocumentationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public DocumentationRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all Documentations of the API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DocumentationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationListResult.DeserializeDocumentationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all Documentations of the API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DocumentationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationListResult.DeserializeDocumentationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Documentation by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, documentationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Documentation by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, documentationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Documentation specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, documentationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DocumentationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DocumentationContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Documentation specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, documentationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DocumentationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DocumentationContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, DocumentationContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new Documentation or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, DocumentationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, documentationId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + DocumentationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new Documentation or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, DocumentationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, documentationId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + DocumentationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, DocumentationContractPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the Documentation for an API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Documentation Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, DocumentationContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, documentationId, ifMatch, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DocumentationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the Documentation for an API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Documentation Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, DocumentationContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, documentationId, ifMatch, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DocumentationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified Documentation from an API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, documentationId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified Documentation from an API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, documentationId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all Documentations of the API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DocumentationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationListResult.DeserializeDocumentationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all Documentations of the API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DocumentationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationListResult.DeserializeDocumentationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs index 949227840259..9f59baeb4029 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs @@ -33,7 +33,7 @@ public EmailTemplateRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Gets all email templates. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string s } /// Gets all email templates. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the email template specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// The cancellation token to use. @@ -190,8 +190,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the email template specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// The cancellation token to use. @@ -245,8 +245,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the email template specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// The cancellation token to use. @@ -277,8 +277,8 @@ public async Task> GetAsync(string subs } /// Gets the details of the email template specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// The cancellation token to use. @@ -339,8 +339,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Updates an Email Template. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// Email Template update parameters. @@ -373,8 +373,8 @@ public async Task> CreateOrUpdateAsync( } /// Updates an Email Template. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// Email Template update parameters. @@ -434,8 +434,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates API Management email template. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -467,8 +467,8 @@ public async Task> UpdateAsync(string s } /// Updates API Management email template. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -523,8 +523,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Reset the Email Template to default template provided by the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -550,8 +550,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Reset the Email Template to default template provided by the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -592,8 +592,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Gets all email templates. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -626,8 +626,8 @@ public async Task> ListByServiceNextPageAsync( /// Gets all email templates. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs index 7547e013049f..5d4ed0c0bde8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs @@ -33,7 +33,7 @@ public GatewayApiRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of the APIs associated with a gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsyn } /// Lists a collection of the APIs associated with a gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Checks that API entity specified by identifier is associated with the Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Checks that API entity specified by identifier is associated with the Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -268,8 +268,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds an API to the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -303,8 +303,8 @@ public async Task> CreateOrUpdateAsync(string subscript } /// Adds an API to the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -362,8 +362,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified API from the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -391,8 +391,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified API from the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -435,8 +435,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of the APIs associated with a gateway. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -471,8 +471,8 @@ public async Task> ListByServiceNext /// Lists a collection of the APIs associated with a gateway. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs index 805dbba2b147..fafce7483492 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs @@ -33,7 +33,7 @@ public GatewayCertificateAuthorityRestOperations(HttpPipeline pipeline, string a { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists the collection of Certificate Authorities for the specified Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq, ne | |</br>. @@ -107,8 +107,8 @@ public async Task> ListByService } /// Lists the collection of Certificate Authorities for the specified Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq, ne | |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Checks if Certificate entity is assigned to Gateway entity as Certificate Authority. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Checks if Certificate entity is assigned to Gateway entity as Certificate Authority. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get assigned Gateway Certificate Authority details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsy } /// Get assigned Gateway Certificate Authority details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Assign Certificate entity to Gateway entity as Certificate Authority. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -400,8 +400,8 @@ public async Task> Create } /// Assign Certificate entity to Gateway entity as Certificate Authority. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -462,8 +462,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Remove relationship between Certificate Authority and Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -492,8 +492,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Remove relationship between Certificate Authority and Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -537,8 +537,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists the collection of Certificate Authorities for the specified Gateway entity. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq, ne | |</br>. @@ -573,8 +573,8 @@ public async Task> ListByService /// Lists the collection of Certificate Authorities for the specified Gateway entity. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq, ne | |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs index 7e6d1623b130..d136f6f6586b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs @@ -33,7 +33,7 @@ public GatewayHostnameConfigurationRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists the collection of hostname configurations for the specified gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| hostname | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServic } /// Lists the collection of hostname configurations for the specified gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| hostname | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Checks that hostname configuration entity specified by identifier exists for specified Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Checks that hostname configuration entity specified by identifier exists for specified Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get details of a hostname configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -296,8 +296,8 @@ public async Task> GetAs } /// Get details of a hostname configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates of updates hostname configuration for a Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -400,8 +400,8 @@ public async Task> Creat } /// Creates of updates hostname configuration for a Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -462,8 +462,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified hostname configuration from the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -492,8 +492,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified hostname configuration from the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -537,8 +537,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists the collection of hostname configurations for the specified gateway. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| hostname | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -573,8 +573,8 @@ public async Task> ListByServic /// Lists the collection of hostname configurations for the specified gateway. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| hostname | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs index 69bad10e7ba6..c20a9920820e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -33,7 +34,7 @@ public GatewayRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +72,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of gateways registered with service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| region | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +104,8 @@ public async Task> ListByServiceAsync(string subscri } /// Lists a collection of gateways registered with service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| region | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +158,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -191,8 +192,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -247,8 +248,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -280,8 +281,8 @@ public async Task> GetAsync(string subscripti } /// Gets the details of the Gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -343,8 +344,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates a Gateway to be used in Api Management instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The to use. @@ -378,8 +379,8 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or updates a Gateway to be used in Api Management instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The to use. @@ -440,8 +441,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -474,8 +475,8 @@ public async Task> UpdateAsync(string subscri } /// Updates the details of the gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -531,8 +532,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -559,8 +560,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -610,8 +611,8 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc } /// Retrieves gateway keys. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -641,8 +642,8 @@ public async Task> ListKeysAsync(string subscripti } /// Retrieves gateway keys. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -699,8 +700,8 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re } /// Regenerates specified gateway key invalidating any tokens created with it. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The to use. @@ -727,8 +728,8 @@ public async Task RegenerateKeyAsync(string subscriptionId, string res } /// Regenerates specified gateway key invalidating any tokens created with it. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The to use. @@ -782,8 +783,8 @@ internal HttpMessage CreateGenerateTokenRequest(string subscriptionId, string re } /// Gets the Shared Access Authorization Token for the gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The to use. @@ -815,8 +816,8 @@ public async Task> GenerateTokenAsync(string subs } /// Gets the Shared Access Authorization Token for the gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The to use. @@ -847,6 +848,291 @@ public Response GenerateToken(string subscriptionId, strin } } + internal HttpMessage CreateInvalidateDebugCredentialsRequest(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/gateways/", false); + uri.AppendPath(gatewayId, true); + uri.AppendPath("/invalidateDebugCredentials", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Action is invalidating all debug credentials issued for gateway. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task InvalidateDebugCredentialsAsync(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + + using var message = CreateInvalidateDebugCredentialsRequest(subscriptionId, resourceGroupName, serviceName, gatewayId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Action is invalidating all debug credentials issued for gateway. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response InvalidateDebugCredentials(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + + using var message = CreateInvalidateDebugCredentialsRequest(subscriptionId, resourceGroupName, serviceName, gatewayId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListDebugCredentialsRequest(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, GatewayListDebugCredentialsContract gatewayListDebugCredentialsContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/gateways/", false); + uri.AppendPath(gatewayId, true); + uri.AppendPath("/listDebugCredentials", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(gatewayListDebugCredentialsContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create new debug credentials for gateway. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. + /// List debug credentials properties. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListDebugCredentialsAsync(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, GatewayListDebugCredentialsContract gatewayListDebugCredentialsContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + Argument.AssertNotNull(gatewayListDebugCredentialsContract, nameof(gatewayListDebugCredentialsContract)); + + using var message = CreateListDebugCredentialsRequest(subscriptionId, resourceGroupName, serviceName, gatewayId, gatewayListDebugCredentialsContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GatewayDebugCredentialsContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GatewayDebugCredentialsContract.DeserializeGatewayDebugCredentialsContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create new debug credentials for gateway. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. + /// List debug credentials properties. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListDebugCredentials(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, GatewayListDebugCredentialsContract gatewayListDebugCredentialsContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + Argument.AssertNotNull(gatewayListDebugCredentialsContract, nameof(gatewayListDebugCredentialsContract)); + + using var message = CreateListDebugCredentialsRequest(subscriptionId, resourceGroupName, serviceName, gatewayId, gatewayListDebugCredentialsContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GatewayDebugCredentialsContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GatewayDebugCredentialsContract.DeserializeGatewayDebugCredentialsContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListTraceRequest(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, GatewayListTraceContract gatewayListTraceContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/gateways/", false); + uri.AppendPath(gatewayId, true); + uri.AppendPath("/listTrace", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(gatewayListTraceContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Fetches trace collected by gateway. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. + /// List trace properties. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task>> ListTraceAsync(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, GatewayListTraceContract gatewayListTraceContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + Argument.AssertNotNull(gatewayListTraceContract, nameof(gatewayListTraceContract)); + + using var message = CreateListTraceRequest(subscriptionId, resourceGroupName, serviceName, gatewayId, gatewayListTraceContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IReadOnlyDictionary value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property.Name, null); + } + else + { + dictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + value = dictionary; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Fetches trace collected by gateway. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. + /// List trace properties. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response> ListTrace(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, GatewayListTraceContract gatewayListTraceContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + Argument.AssertNotNull(gatewayListTraceContract, nameof(gatewayListTraceContract)); + + using var message = CreateListTraceRequest(subscriptionId, resourceGroupName, serviceName, gatewayId, gatewayListTraceContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IReadOnlyDictionary value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + Dictionary dictionary = new Dictionary(); + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property.Name, null); + } + else + { + dictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + value = dictionary; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) { var message = _pipeline.CreateMessage(); @@ -863,8 +1149,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of gateways registered with service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| region | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -897,8 +1183,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists a collection of gateways registered with service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| region | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs index fd541b91c8c4..753b8344fc7e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs @@ -33,7 +33,7 @@ public GlobalSchemaRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of schemas registered with service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string su } /// Lists a collection of schemas registered with service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subsc } /// Gets the details of the Schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates new or updates existing specified Schema of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -366,7 +366,6 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -374,8 +373,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates new or updates existing specified Schema of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -397,7 +396,6 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -428,8 +426,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific Schema. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -456,8 +454,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific Schema. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -499,8 +497,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of schemas registered with service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -533,8 +531,8 @@ public async Task> ListByServiceNextPageAsync(s /// Lists a collection of schemas registered with service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverPolicyRestOperations.cs new file mode 100644 index 000000000000..19ff708b4b59 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverPolicyRestOperations.cs @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class GraphQLApiResolverPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GraphQLApiResolverPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public GraphQLApiResolverPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByResolverRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResolverAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateListByResolverRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByResolver(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateListByResolverRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the GraphQL API Resolver level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the GraphQL API Resolver level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the GraphQL Api Resolver. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the GraphQL Api Resolver. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResolverNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResolverNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateListByResolverNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByResolverNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateListByResolverNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverRestOperations.cs new file mode 100644 index 000000000000..d4097c504928 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverRestOperations.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class GraphQLApiResolverRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GraphQLApiResolverRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public GraphQLApiResolverRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the resolvers for the specified GraphQL API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResolverListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverListResult.DeserializeResolverListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the resolvers for the specified GraphQL API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResolverListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverListResult.DeserializeResolverListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResolverContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ResolverContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResolverContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ResolverContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ResolverContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new resolver in the GraphQL API or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ResolverContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ResolverContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new resolver in the GraphQL API or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ResolverContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ResolverContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, ResolverContractPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the resolver in the GraphQL API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// GraphQL API Resolver Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, ResolverContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, ifMatch, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResolverContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the resolver in the GraphQL API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// GraphQL API Resolver Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, ResolverContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, ifMatch, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResolverContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified resolver in the GraphQL API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified resolver in the GraphQL API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the resolvers for the specified GraphQL API. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResolverListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverListResult.DeserializeResolverListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the resolvers for the specified GraphQL API. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApiNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResolverListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverListResult.DeserializeResolverListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs index d2b9d5b8f780..a2a95913fa1a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs @@ -33,7 +33,7 @@ public GroupRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of groups defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subscript } /// Lists a collection of groups defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -312,7 +312,7 @@ public Response Get(string subscriptionId, string resour } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -335,32 +335,32 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(groupCreateParameters); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates or Updates a group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, groupCreateParameters, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -378,24 +378,24 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates or Updates a group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, groupCreateParameters, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -412,7 +412,7 @@ public Response CreateOrUpdate(string subscriptionId, st } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, ApiManagementGroupPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -433,31 +433,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(groupUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the details of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, ApiManagementGroupPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, ifMatch, groupUpdateParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -474,24 +474,24 @@ public async Task> UpdateAsync(string subscript } /// Updates the details of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, ApiManagementGroupPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, ifMatch, groupUpdateParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific group of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific group of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -602,8 +602,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of groups defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. /// Number of records to return. @@ -636,8 +636,8 @@ public async Task> ListByServiceNextPageAsync(string n /// Lists a collection of groups defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupUserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupUserRestOperations.cs index d184feb34eaf..3b580231fe2b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupUserRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupUserRestOperations.cs @@ -33,7 +33,7 @@ public GroupUserRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists a collection of user entities associated with the group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListAsync(string s } /// Lists a collection of user entities associated with the group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Checks that user entity specified by identifier is associated with the group entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Checks that user entity specified by identifier is associated with the group entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Add existing user to existing group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -295,8 +295,8 @@ public async Task> CreateAsync(string subsc } /// Add existing user to existing group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -353,8 +353,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Remove existing user from existing group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -382,8 +382,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Remove existing user from existing group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -426,8 +426,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists a collection of user entities associated with the group. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -462,8 +462,8 @@ public async Task> ListNextPageAsync( /// Lists a collection of user entities associated with the group. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs index 378aa6d7cccd..6d06481f1f10 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs @@ -33,7 +33,7 @@ public IdentityProviderRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of Identity Provider configured in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string subs } /// Lists a collection of Identity Provider configured in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -139,8 +139,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the identityProvider specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -172,8 +172,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the identityProvider specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -227,8 +227,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the configuration details of the identity Provider configured in specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -259,8 +259,8 @@ public async Task> GetAsync(string s } /// Gets the configuration details of the identity Provider configured in specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -321,8 +321,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates the IdentityProvider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// Create parameters. @@ -355,8 +355,8 @@ public async Task> CreateOrUpdateAsy } /// Creates or Updates the IdentityProvider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// Create parameters. @@ -416,8 +416,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing IdentityProvider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -449,8 +449,8 @@ public async Task> UpdateAsync(strin } /// Updates an existing IdentityProvider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -505,8 +505,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified identity provider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -532,8 +532,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified identity provider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -582,8 +582,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the client secret details of the Identity Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -612,8 +612,8 @@ public async Task> ListSecretsAsync(string subscr } /// Gets the client secret details of the Identity Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -657,8 +657,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of Identity Provider configured in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. @@ -688,8 +688,8 @@ public async Task> ListByServiceNextPageAsync(str /// Lists a collection of Identity Provider configured in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IssueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IssueRestOperations.cs index d08359464c46..9ba1f9b947fd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IssueRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IssueRestOperations.cs @@ -33,7 +33,7 @@ public IssueRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of issues in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subscript } /// Lists a collection of issues in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets API Management issue details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Issue identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -190,8 +190,8 @@ public async Task> GetAsync(string subscriptionId, s } /// Gets API Management issue details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Issue identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -238,8 +238,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of issues in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. /// Number of records to return. @@ -272,8 +272,8 @@ public async Task> ListByServiceNextPageAsync(string n /// Lists a collection of issues in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs index 31ff806591be..602bda83bbf0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs @@ -33,7 +33,7 @@ public LoggerRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of loggers in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| loggerType | filter | eq | |</br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subscrip } /// Lists a collection of loggers in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| loggerType | filter | eq | |</br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the logger specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the logger specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the logger specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscriptio } /// Gets the details of the logger specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// Create parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or Updates a logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// Create parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -474,8 +474,8 @@ public async Task> UpdateAsync(string subscrip } /// Updates an existing logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -602,8 +602,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of loggers in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| loggerType | filter | eq | |</br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -636,8 +636,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists a collection of loggers in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| loggerType | filter | eq | |</br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs index 77ffcce7803f..af014d1ac348 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs @@ -33,7 +33,7 @@ public NamedValueRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of named values defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -108,8 +108,8 @@ public async Task> ListByServiceAsync(string subs } /// Lists a collection of named values defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -163,8 +163,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -197,8 +197,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -253,8 +253,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -286,8 +286,8 @@ public async Task> GetAsync(string subscri } /// Gets the details of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -318,7 +318,7 @@ public Response Get(string subscriptionId, string r } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -341,38 +341,37 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(namedValueCreateContract); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates or updates named value. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, namedValueCreateContract, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -380,37 +379,36 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates named value. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, namedValueCreateContract, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, ApiManagementNamedValuePatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -431,31 +429,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(namedValueUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the specific named value. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, ApiManagementNamedValuePatch patch, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, ifMatch, namedValueUpdateParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -468,24 +466,24 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates the specific named value. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, ApiManagementNamedValuePatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, ifMatch, namedValueUpdateParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -521,8 +519,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific named value from the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -549,8 +547,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific named value from the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -600,8 +598,8 @@ internal HttpMessage CreateListValueRequest(string subscriptionId, string resour } /// Gets the secret of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -631,8 +629,8 @@ public async Task> ListValueAsync(string subs } /// Gets the secret of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -685,8 +683,8 @@ internal HttpMessage CreateRefreshSecretRequest(string subscriptionId, string re } /// Refresh the secret of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -712,8 +710,8 @@ public async Task RefreshSecretAsync(string subscriptionId, string res } /// Refresh the secret of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -754,8 +752,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of named values defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -789,8 +787,8 @@ public async Task> ListByServiceNextPageAsync(str /// Lists a collection of named values defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NetworkStatusRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NetworkStatusRestOperations.cs index f948fbc9c45c..88c7fd69b461 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NetworkStatusRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NetworkStatusRestOperations.cs @@ -34,7 +34,7 @@ public NetworkStatusRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -60,8 +60,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -94,8 +94,8 @@ public async Task>> Li } /// Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -151,8 +151,8 @@ internal HttpMessage CreateListByLocationRequest(string subscriptionId, string r } /// Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. /// The cancellation token to use. @@ -181,8 +181,8 @@ public async Task> ListByLocationAsync(string su } /// Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientEmailRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientEmailRestOperations.cs index ec774781433e..ac955fabb64b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientEmailRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientEmailRestOperations.cs @@ -33,7 +33,7 @@ public NotificationRecipientEmailRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByNotificationRequest(string subscriptionId, stri } /// Gets the list of the Notification Recipient Emails subscribed to a notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -91,8 +91,8 @@ public async Task> ListByNotificationAsync(st } /// Gets the list of the Notification Recipient Emails subscribed to a notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -145,8 +145,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Determine if Notification Recipient Email subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -180,8 +180,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Determine if Notification Recipient Email subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -239,8 +239,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds the Email address to the list of Recipients for the Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -272,8 +272,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Adds the Email address to the list of Recipients for the Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -329,8 +329,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Removes the email from the list of Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -357,8 +357,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Removes the email from the list of Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientUserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientUserRestOperations.cs index 693f735626df..872fc3f0f9c4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientUserRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientUserRestOperations.cs @@ -33,7 +33,7 @@ public NotificationRecipientUserRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByNotificationRequest(string subscriptionId, stri } /// Gets the list of the Notification Recipient User subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -91,8 +91,8 @@ public async Task> ListByNotificationAsync(str } /// Gets the list of the Notification Recipient User subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -145,8 +145,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Determine if the Notification Recipient User is subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -180,8 +180,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Determine if the Notification Recipient User is subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -239,8 +239,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds the API Management User to the list of Recipients for the Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -272,8 +272,8 @@ public async Task> CreateOrUpdateAsync(string su } /// Adds the API Management User to the list of Recipients for the Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -329,8 +329,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Removes the API Management user from the list of Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -357,8 +357,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Removes the API Management user from the list of Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRestOperations.cs index 89141a266e84..8befcf212565 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRestOperations.cs @@ -33,7 +33,7 @@ public NotificationRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -67,8 +67,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of properties defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -98,8 +98,8 @@ public async Task> ListByServiceAsync(string su } /// Lists a collection of properties defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -151,8 +151,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Notification specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -183,8 +183,8 @@ public async Task> GetAsync(string subsc } /// Gets the details of the Notification specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -241,8 +241,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or Update API Management publisher notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -272,8 +272,8 @@ public async Task> CreateOrUpdateAsync(s } /// Create or Update API Management publisher notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -318,8 +318,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of properties defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -351,8 +351,8 @@ public async Task> ListByServiceNextPageAsync(s /// Lists a collection of properties defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs index 9440dca4fcfb..8926a5cfe66b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs @@ -33,7 +33,7 @@ public OpenIdConnectProviderRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists of all the OpenId Connect Providers. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync( } /// Lists of all the OpenId Connect Providers. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets specific OpenID Connect Provider without secrets. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(str } /// Gets specific OpenID Connect Provider without secrets. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates the OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// Create parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpda } /// Creates or updates the OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// Create parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the specific OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -474,8 +474,8 @@ public async Task> UpdateAsync( } /// Updates the specific OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific OpenID Connect Provider of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific OpenID Connect Provider of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -610,8 +610,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the client secret details of the OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -641,8 +641,8 @@ public async Task> ListSecretsAsync(string subscr } /// Gets the client secret details of the OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -687,8 +687,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists of all the OpenId Connect Providers. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -721,8 +721,8 @@ public async Task> ListByServiceNextPa /// Lists of all the OpenId Connect Providers. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OperationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OperationRestOperations.cs index 11ff847f05ec..f30739420dae 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OperationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OperationRestOperations.cs @@ -33,7 +33,7 @@ public OperationRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -77,8 +77,8 @@ internal HttpMessage CreateListByTagsRequest(string subscriptionId, string resou } /// Lists a collection of operations associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -112,8 +112,8 @@ public async Task> ListByTagsAsync(string subscr } /// Lists a collection of operations associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -162,8 +162,8 @@ internal HttpMessage CreateListByTagsNextPageRequest(string nextLink, string sub /// Lists a collection of operations associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -199,8 +199,8 @@ public async Task> ListByTagsNextPageAsync(strin /// Lists a collection of operations associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OutboundNetworkDependenciesEndpointsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OutboundNetworkDependenciesEndpointsRestOperations.cs index 6d3684c38d52..df657f144514 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OutboundNetworkDependenciesEndpointsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OutboundNetworkDependenciesEndpointsRestOperations.cs @@ -33,7 +33,7 @@ public OutboundNetworkDependenciesEndpointsRestOperations(HttpPipeline pipeline, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Gets the network endpoints of all outbound dependencies of a ApiManagement service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync( } /// Gets the network endpoints of all outbound dependencies of a ApiManagement service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyDescriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyDescriptionRestOperations.cs index 6609aeb8ad4e..52820082f786 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyDescriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyDescriptionRestOperations.cs @@ -33,7 +33,7 @@ public PolicyDescriptionRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all policy descriptions. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Policy scope. /// The cancellation token to use. @@ -93,8 +93,8 @@ public async Task> ListByServiceAsync(stri } /// Lists all policy descriptions. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Policy scope. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyFragmentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyFragmentRestOperations.cs new file mode 100644 index 000000000000..32e489e43f5d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyFragmentRestOperations.cs @@ -0,0 +1,677 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class PolicyFragmentRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PolicyFragmentRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PolicyFragmentRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string filter, string orderBy, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all policy fragments. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, orderBy, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all policy fragments. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, orderBy, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string id) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, id); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, id); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContentFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, id, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyFragmentContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, id, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyFragmentContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, id, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, id, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string id, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, id, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string id, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, id, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListReferencesRequest(string subscriptionId, string resourceGroupName, string serviceName, string id, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendPath("/listReferences", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists policy resources that reference the policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListReferencesAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateListReferencesRequest(subscriptionId, resourceGroupName, serviceName, id, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists policy resources that reference the policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListReferences(string subscriptionId, string resourceGroupName, string serviceName, string id, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateListReferencesRequest(subscriptionId, resourceGroupName, serviceName, id, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter, string orderBy, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all policy fragments. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, orderBy, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all policy fragments. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, orderBy, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs index bfcb2325068f..a4f89a00d0ed 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs @@ -33,7 +33,7 @@ public PolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all the Global Policy definitions of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string subscrip } /// Lists all the Global Policy definitions of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -139,8 +139,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Global policy definition in the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// The cancellation token to use. @@ -172,8 +172,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Global policy definition in the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// The cancellation token to use. @@ -231,8 +231,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the Global policy definition of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// Policy Export Format. @@ -264,8 +264,8 @@ public async Task> GetAsync(string subscriptionId, } /// Get the Global policy definition of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// Policy Export Format. @@ -327,8 +327,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates the global policy configuration of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// The policy contents to apply. @@ -361,8 +361,8 @@ public async Task> CreateOrUpdateAsync(string subsc } /// Creates or updates the global policy configuration of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// The policy contents to apply. @@ -418,8 +418,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the global policy configuration of the Api Management Service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -445,8 +445,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the global policy configuration of the Api Management Service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -470,5 +470,81 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s throw new RequestFailedException(message.Response); } } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the Global Policy definitions of the Api Management service. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the Global Policy definitions of the Api Management service. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestrictionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestrictionRestOperations.cs new file mode 100644 index 000000000000..2da6e7688721 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestrictionRestOperations.cs @@ -0,0 +1,650 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class PolicyRestrictionRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PolicyRestrictionRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PolicyRestrictionRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyRestrictions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all policy restrictions of API Management services. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyRestrictionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyRestrictionListResult.DeserializePolicyRestrictionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all policy restrictions of API Management services. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyRestrictionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyRestrictionListResult.DeserializePolicyRestrictionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyRestrictions/", false); + uri.AppendPath(policyRestrictionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the policy restriction in the Api Management service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the policy restriction in the Api Management service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyRestrictions/", false); + uri.AppendPath(policyRestrictionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy restriction of the Api Management service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyRestrictionContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyRestrictionContractData.DeserializePolicyRestrictionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyRestrictionContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy restriction of the Api Management service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyRestrictionContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyRestrictionContractData.DeserializePolicyRestrictionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyRestrictionContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, PolicyRestrictionContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyRestrictions/", false); + uri.AppendPath(policyRestrictionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates the policy restriction configuration of the Api Management service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// The policy restriction to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, PolicyRestrictionContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyRestrictionContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyRestrictionContractData.DeserializePolicyRestrictionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates the policy restriction configuration of the Api Management service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// The policy restriction to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, PolicyRestrictionContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyRestrictionContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyRestrictionContractData.DeserializePolicyRestrictionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, ETag ifMatch, PolicyRestrictionContractPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyRestrictions/", false); + uri.AppendPath(policyRestrictionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the policy restriction configuration of the Api Management service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The policy restriction to apply. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, ETag ifMatch, PolicyRestrictionContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId, ifMatch, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyRestrictionContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyRestrictionContractData.DeserializePolicyRestrictionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the policy restriction configuration of the Api Management service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The policy restriction to apply. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, ETag ifMatch, PolicyRestrictionContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId, ifMatch, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyRestrictionContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyRestrictionContractData.DeserializePolicyRestrictionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyRestrictions/", false); + uri.AppendPath(policyRestrictionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy restriction configuration of the Api Management Service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy restriction configuration of the Api Management Service. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Policy restrictions after an entity level. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string policyRestrictionId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(policyRestrictionId, nameof(policyRestrictionId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, policyRestrictionId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all policy restrictions of API Management services. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyRestrictionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyRestrictionListResult.DeserializePolicyRestrictionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all policy restrictions of API Management services. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyRestrictionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyRestrictionListResult.DeserializePolicyRestrictionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestrictionValidationsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestrictionValidationsRestOperations.cs new file mode 100644 index 000000000000..29297ae0ffa1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestrictionValidationsRestOperations.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class PolicyRestrictionValidationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PolicyRestrictionValidationsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PolicyRestrictionValidationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/validatePolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Validate all policies of API Management services. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task ByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateByServiceRequest(subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Validate all policies of API Management services. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ByService(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateByServiceRequest(subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalConfigRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalConfigRestOperations.cs new file mode 100644 index 000000000000..81829d58d68c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalConfigRestOperations.cs @@ -0,0 +1,563 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class PortalConfigRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PortalConfigRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PortalConfigRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the developer portal configurations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PortalConfigListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PortalConfigListResult.DeserializePortalConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the developer portal configurations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PortalConfigListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PortalConfigListResult.DeserializePortalConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs/", false); + uri.AppendPath(portalConfigId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the developer portal configuration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the developer portal configuration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs/", false); + uri.AppendPath(portalConfigId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the developer portal configuration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PortalConfigContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the developer portal configuration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PortalConfigContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs/", false); + uri.AppendPath(portalConfigId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update the developer portal configuration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId, ifMatch, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the developer portal configuration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId, ifMatch, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs/", false); + uri.AppendPath(portalConfigId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update the developer portal configuration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId, ifMatch, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update the developer portal configuration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId, ifMatch, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the developer portal configurations. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PortalConfigListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PortalConfigListResult.DeserializePortalConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the developer portal configurations. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PortalConfigListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PortalConfigListResult.DeserializePortalConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs index 73d0b49ecd73..4f100dd0916c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs @@ -33,7 +33,7 @@ public PortalRevisionRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists developer portal's revisions. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// /// | Field | Supported operators | Supported functions | @@ -111,8 +111,8 @@ public async Task> ListByServiceAsync(string } /// Lists developer portal's revisions. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// /// | Field | Supported operators | Supported functions | @@ -173,8 +173,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the developer portal revision specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -207,8 +207,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the developer portal revision specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -263,8 +263,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the developer portal's revision specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -296,8 +296,8 @@ public async Task> GetAsync(string sub } /// Gets the developer portal's revision specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -355,8 +355,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new developer portal's revision by running the portal's publishing. The `isCurrent` property indicates if the revision is publicly accessible. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The to use. @@ -376,7 +376,6 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re switch (message.Response.Status) { case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -384,8 +383,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates a new developer portal's revision by running the portal's publishing. The `isCurrent` property indicates if the revision is publicly accessible. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The to use. @@ -405,7 +404,6 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, switch (message.Response.Status) { case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -440,8 +438,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the description of specified portal revision or makes it current. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -470,8 +468,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates the description of specified portal revision or makes it current. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -515,8 +513,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists developer portal's revisions. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// /// | Field | Supported operators | Supported functions | @@ -557,8 +555,8 @@ public async Task> ListByServiceNextPageAsync /// Lists developer portal's revisions. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// /// | Field | Supported operators | Supported functions | diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalSettingsRestOperations.cs index 3172d33c04fa..2df3a801403e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalSettingsRestOperations.cs @@ -33,7 +33,7 @@ public PortalSettingsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of portalsettings defined within a service instance.. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string } /// Lists a collection of portalsettings defined within a service instance.. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs index 40e9d09d1803..40d406060d47 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs @@ -33,7 +33,7 @@ public PrivateEndpointConnectionRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all private endpoint connections of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> Li } /// Lists all private endpoint connections of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -139,8 +139,8 @@ internal HttpMessage CreateGetByNameRequest(string subscriptionId, string resour } /// Gets the details of the Private Endpoint Connection specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The cancellation token to use. @@ -172,8 +172,8 @@ public async Task> GetByNam } /// Gets the details of the Private Endpoint Connection specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The cancellation token to use. @@ -231,8 +231,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Private Endpoint Connection or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The to use. @@ -260,8 +260,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates a new Private Endpoint Connection or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The to use. @@ -311,8 +311,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified Private Endpoint Connection. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The cancellation token to use. @@ -339,8 +339,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified Private Endpoint Connection. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The cancellation token to use. @@ -388,8 +388,8 @@ internal HttpMessage CreateListPrivateLinkResourcesRequest(string subscriptionId } /// Gets the private link resources. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -417,8 +417,8 @@ public async Task> ListPriv } /// Gets the private link resources. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -468,8 +468,8 @@ internal HttpMessage CreateGetPrivateLinkResourceRequest(string subscriptionId, } /// Gets the private link resources. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private link resource. /// The cancellation token to use. @@ -501,8 +501,8 @@ public async Task> GetPrivateLink } /// Gets the private link resources. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private link resource. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiLinkRestOperations.cs new file mode 100644 index 000000000000..372fbdf86fa7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class ProductApiLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProductApiLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ProductApiLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the API link for the product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the API link for the product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, ProductApiLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an API to the specified product via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an API to the specified product via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API from the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API from the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiRestOperations.cs index 4fd75fe05ef9..f8854e7e765d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiRestOperations.cs @@ -33,7 +33,7 @@ public ProductApiRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Lists a collection of the APIs associated with a product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByProductAsyn } /// Lists a collection of the APIs associated with a product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Checks that API entity specified by identifier is associated with the Product entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. @@ -201,8 +201,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Checks that API entity specified by identifier is associated with the Product entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. @@ -261,8 +261,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds an API to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. @@ -295,8 +295,8 @@ public async Task> CreateOrUpdateAsync(string subscript } /// Adds an API to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. @@ -353,8 +353,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified API from the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. @@ -382,8 +382,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified API from the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. @@ -426,8 +426,8 @@ internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string /// Lists a collection of the APIs associated with a product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -462,8 +462,8 @@ public async Task> ListByProductNext /// Lists a collection of the APIs associated with a product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupLinkRestOperations.cs new file mode 100644 index 000000000000..fe610c3d8966 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class ProductGroupLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProductGroupLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ProductGroupLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the group links associated with a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the group links associated with a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the group link for the product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductGroupLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the group link for the product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductGroupLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, ProductGroupLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds a group to the specified product via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductGroupLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds a group to the specified product via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductGroupLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified group from the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified group from the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the group links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the group links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupRestOperations.cs index 28489ace25ad..8320de3efb8b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupRestOperations.cs @@ -33,7 +33,7 @@ public ProductGroupRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Lists the collection of developer groups associated with the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | |</br>| displayName | filter | eq, ne | |</br>| description | filter | eq, ne | |</br>. @@ -107,8 +107,8 @@ public async Task> ListByProductAs } /// Lists the collection of developer groups associated with the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | |</br>| displayName | filter | eq, ne | |</br>| description | filter | eq, ne | |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Checks that Group entity specified by identifier is associated with the Product entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Checks that Group entity specified by identifier is associated with the Product entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds the association between the specified developer group with the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -295,8 +295,8 @@ public async Task> CreateOrUpdateAsync(string subscri } /// Adds the association between the specified developer group with the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -353,8 +353,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the association between the specified group and product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -382,8 +382,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the association between the specified group and product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -426,8 +426,8 @@ internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string /// Lists the collection of developer groups associated with the specified product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | |</br>| displayName | filter | eq, ne | |</br>| description | filter | eq, ne | |</br>. @@ -462,8 +462,8 @@ public async Task> ListByProductNe /// Lists the collection of developer groups associated with the specified product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | |</br>| displayName | filter | eq, ne | |</br>| description | filter | eq, ne | |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs index e678181bea6d..ebc98a75baa7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs @@ -33,7 +33,7 @@ public ProductPolicyRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Get the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -92,8 +92,8 @@ public async Task> ListByProductAsync(string subscrip } /// Get the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -147,8 +147,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Get the ETag of the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -182,8 +182,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Get the ETag of the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -245,8 +245,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscriptionId, } /// Get the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -347,8 +347,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates policy configuration for the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -383,8 +383,8 @@ public async Task> CreateOrUpdateAsync(string subsc } /// Creates or updates policy configuration for the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -444,8 +444,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the policy configuration at the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -473,8 +473,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the policy configuration at the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -500,5 +500,85 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s throw new RequestFailedException(message.Response); } } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the Product level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the Product level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs index 984cc09406b0..8c7af2199536 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs @@ -33,7 +33,7 @@ public ProductRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -79,8 +79,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of products in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -113,8 +113,8 @@ public async Task> ListByServiceAsync(string subscri } /// Lists a collection of products in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -169,8 +169,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the product specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -203,8 +203,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the product specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -259,8 +259,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the product specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -292,8 +292,8 @@ public async Task> GetAsync(string subscripti } /// Gets the details of the product specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -355,8 +355,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -390,8 +390,8 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or Updates a product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -424,7 +424,7 @@ public Response CreateOrUpdate(string subscriptionId, } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ApiManagementProductPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -445,31 +445,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(productUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Update existing product details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ApiManagementProductPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, productUpdateParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -486,24 +486,24 @@ public async Task> UpdateAsync(string subscri } /// Update existing product details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ApiManagementProductPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, productUpdateParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -547,8 +547,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Delete product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -576,8 +576,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Delete product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -642,8 +642,8 @@ internal HttpMessage CreateListByTagsRequest(string subscriptionId, string resou } /// Lists a collection of products associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -675,8 +675,8 @@ public async Task> ListByTagsAsync(string subscr } /// Lists a collection of products associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -723,8 +723,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of products in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -759,8 +759,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists a collection of products in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -809,8 +809,8 @@ internal HttpMessage CreateListByTagsNextPageRequest(string nextLink, string sub /// Lists a collection of products associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -844,8 +844,8 @@ public async Task> ListByTagsNextPageAsync(strin /// Lists a collection of products associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductSubscriptionsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductSubscriptionsRestOperations.cs index cf61410e2068..6717f2e106a5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductSubscriptionsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductSubscriptionsRestOperations.cs @@ -33,7 +33,7 @@ public ProductSubscriptionsRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists the collection of subscriptions to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. @@ -107,8 +107,8 @@ public async Task> ListAsync(string subscriptio } /// Lists the collection of subscriptions to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. @@ -156,8 +156,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists the collection of subscriptions to the specified product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. @@ -192,8 +192,8 @@ public async Task> ListNextPageAsync(string nex /// Lists the collection of subscriptions to the specified product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductWikiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductWikiRestOperations.cs new file mode 100644 index 000000000000..7e6c036dd781 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductWikiRestOperations.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class ProductWikiRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProductWikiRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ProductWikiRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WikiContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WikiContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, WikiContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new Wiki for a Product or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new Wiki for a Product or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string productId, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, WikiUpdateContract wikiUpdateContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(wikiUpdateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Wiki Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, wikiUpdateContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Wiki Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, wikiUpdateContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified Wiki from a Product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified Wiki from a Product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs index 40b84a3b0a5d..b9c07c00109f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs @@ -33,7 +33,7 @@ public QuotaByCounterKeysRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -60,8 +60,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// The cancellation token to use. @@ -91,8 +91,8 @@ public async Task> ListByServiceAsync(string su } /// Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// The cancellation token to use. @@ -148,8 +148,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// The value of the quota counter to be applied to all quota counter periods. @@ -181,8 +181,8 @@ public async Task> UpdateAsync(string subscript } /// Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// The value of the quota counter to be applied to all quota counter periods. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs index a10b185faa43..3ddcbdf052bb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs @@ -33,7 +33,7 @@ public QuotaByPeriodKeysRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -62,8 +62,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// Quota period key identifier. @@ -95,8 +95,8 @@ public async Task> GetAsync(string subscriptionId } /// Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// Quota period key identifier. @@ -156,8 +156,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing quota counter value in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// Quota period key identifier. @@ -191,8 +191,8 @@ public async Task> UpdateAsync(string subscriptio } /// Updates an existing quota counter value in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// Quota period key identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/RegionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/RegionRestOperations.cs index f7d52add08f0..2dcdbf6694bc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/RegionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/RegionRestOperations.cs @@ -33,7 +33,7 @@ public RegionRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all azure regions in which the service exists. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string subscrip } /// Lists all azure regions in which the service exists. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -132,8 +132,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all azure regions in which the service exists. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. @@ -163,8 +163,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists all azure regions in which the service exists. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ReportsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ReportsRestOperations.cs index aac9218c91ff..ea76a2475115 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ReportsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ReportsRestOperations.cs @@ -33,7 +33,7 @@ public ReportsRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -72,8 +72,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Lists report records by API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The filter to apply on the operation. /// Number of records to return. @@ -106,8 +106,8 @@ public async Task> ListByApiAsync(string subscription } /// Lists report records by API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The filter to apply on the operation. /// Number of records to return. @@ -174,8 +174,8 @@ internal HttpMessage CreateListByUserRequest(string subscriptionId, string resou } /// Lists report records by User. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -208,8 +208,8 @@ public async Task> ListByUserAsync(string subscriptio } /// Lists report records by User. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -276,8 +276,8 @@ internal HttpMessage CreateListByOperationRequest(string subscriptionId, string } /// Lists report records by API Operations. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -310,8 +310,8 @@ public async Task> ListByOperationAsync(string subscr } /// Lists report records by API Operations. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -378,8 +378,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Lists report records by Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -412,8 +412,8 @@ public async Task> ListByProductAsync(string subscrip } /// Lists report records by Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -476,8 +476,8 @@ internal HttpMessage CreateListByGeoRequest(string subscriptionId, string resour } /// Lists report records by geography. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -509,8 +509,8 @@ public async Task> ListByGeoAsync(string subscription } /// Lists report records by geography. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -576,8 +576,8 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, stri } /// Lists report records by subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -610,8 +610,8 @@ public async Task> ListBySubscriptionAsync(string sub } /// Lists report records by subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -679,8 +679,8 @@ internal HttpMessage CreateListByTimeRequest(string subscriptionId, string resou } /// Lists report records by Time. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). @@ -714,8 +714,8 @@ public async Task> ListByTimeAsync(string subscriptio } /// Lists report records by Time. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). @@ -779,8 +779,8 @@ internal HttpMessage CreateListByRequestRequest(string subscriptionId, string re } /// Lists report records by Request. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br>. /// Number of records to return. @@ -812,8 +812,8 @@ public async Task> ListByRequestAsync(string s } /// Lists report records by Request. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br>. /// Number of records to return. @@ -860,8 +860,8 @@ internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subs /// Lists report records by API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The filter to apply on the operation. /// Number of records to return. @@ -896,8 +896,8 @@ public async Task> ListByApiNextPageAsync(string next /// Lists report records by API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The filter to apply on the operation. /// Number of records to return. @@ -946,8 +946,8 @@ internal HttpMessage CreateListByUserNextPageRequest(string nextLink, string sub /// Lists report records by User. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -982,8 +982,8 @@ public async Task> ListByUserNextPageAsync(string nex /// Lists report records by User. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1032,8 +1032,8 @@ internal HttpMessage CreateListByOperationNextPageRequest(string nextLink, strin /// Lists report records by API Operations. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1068,8 +1068,8 @@ public async Task> ListByOperationNextPageAsync(strin /// Lists report records by API Operations. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1118,8 +1118,8 @@ internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string /// Lists report records by Product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1154,8 +1154,8 @@ public async Task> ListByProductNextPageAsync(string /// Lists report records by Product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1204,8 +1204,8 @@ internal HttpMessage CreateListByGeoNextPageRequest(string nextLink, string subs /// Lists report records by geography. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1239,8 +1239,8 @@ public async Task> ListByGeoNextPageAsync(string next /// Lists report records by geography. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1288,8 +1288,8 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// Lists report records by subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1324,8 +1324,8 @@ public async Task> ListBySubscriptionNextPageAsync(st /// Lists report records by subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1374,8 +1374,8 @@ internal HttpMessage CreateListByTimeNextPageRequest(string nextLink, string sub /// Lists report records by Time. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). @@ -1411,8 +1411,8 @@ public async Task> ListByTimeNextPageAsync(string nex /// Lists report records by Time. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs index deb05abf569f..99c7a051607d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs @@ -32,7 +32,7 @@ public SignInSettingsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -58,8 +58,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the SignInSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -90,8 +90,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the SignInSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -143,8 +143,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get Sign In Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -174,8 +174,8 @@ public async Task> GetAsync(strin } /// Get Sign In Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -231,8 +231,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update Sign-In settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. /// Update Sign-In settings. @@ -258,8 +258,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update Sign-In settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. /// Update Sign-In settings. @@ -314,8 +314,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or Update Sign-In settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -346,8 +346,8 @@ public async Task> CreateOrUpdate } /// Create or Update Sign-In settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs index 31a99a99d471..e68b8a46b398 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs @@ -32,7 +32,7 @@ public SignUpSettingsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -58,8 +58,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the SignUpSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -90,8 +90,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the SignUpSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -143,8 +143,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get Sign Up Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -174,8 +174,8 @@ public async Task> GetAsync(strin } /// Get Sign Up Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -231,8 +231,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update Sign-Up settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. /// Update Sign-Up settings. @@ -258,8 +258,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update Sign-Up settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. /// Update Sign-Up settings. @@ -314,8 +314,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or Update Sign-Up settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -346,8 +346,8 @@ public async Task> CreateOrUpdate } /// Create or Update Sign-Up settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs index 74c8efda0bb8..716594a9224a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs @@ -33,7 +33,7 @@ public SubscriptionRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists all subscriptions of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListAsync(string subscriptio } /// Lists all subscriptions of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the specified Subscription entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscripti } /// Gets the specified Subscription entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -312,7 +312,7 @@ public Response Get(string subscriptionId, string reso } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify, ETag? ifMatch, AppType? appType) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify, ETag? ifMatch, AppType? appType) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -343,19 +343,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(subscriptionCreateParameters); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates or updates the subscription of specified user to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. - /// Create parameters. + /// Create parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -364,17 +364,17 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, content, notify, ifMatch, appType); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, subscriptionCreateParameters, notify, ifMatch, appType); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -392,11 +392,11 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or updates the subscription of specified user to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. - /// Create parameters. + /// Create parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -405,17 +405,17 @@ public async Task> CreateOrUpdateAsync(string /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, content, notify, ifMatch, appType); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, subscriptionCreateParameters, notify, ifMatch, appType); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -432,7 +432,7 @@ public Response CreateOrUpdate(string subscriptionId, } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify, AppType? appType) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify, AppType? appType) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -461,19 +461,19 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(subscriptionUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the details of a subscription specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -481,17 +481,17 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, ifMatch, patch, notify, appType); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, ifMatch, subscriptionUpdateParameters, notify, appType); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -508,12 +508,12 @@ public async Task> UpdateAsync(string subscri } /// Updates the details of a subscription specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -521,17 +521,17 @@ public async Task> UpdateAsync(string subscri /// /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, ifMatch, patch, notify, appType); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, ifMatch, subscriptionUpdateParameters, notify, appType); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -571,8 +571,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -599,8 +599,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -650,8 +650,8 @@ internal HttpMessage CreateRegeneratePrimaryKeyRequest(string subscriptionId, st } /// Regenerates primary key of existing subscription of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -676,8 +676,8 @@ public async Task RegeneratePrimaryKeyAsync(string subscriptionId, str } /// Regenerates primary key of existing subscription of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -725,8 +725,8 @@ internal HttpMessage CreateRegenerateSecondaryKeyRequest(string subscriptionId, } /// Regenerates secondary key of existing subscription of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -751,8 +751,8 @@ public async Task RegenerateSecondaryKeyAsync(string subscriptionId, s } /// Regenerates secondary key of existing subscription of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -800,8 +800,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the specified Subscription keys. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -831,8 +831,8 @@ public async Task> ListSecretsAsync(string su } /// Gets the specified Subscription keys. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -877,8 +877,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists all subscriptions of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. /// Number of records to return. @@ -911,8 +911,8 @@ public async Task> ListNextPageAsync(string nex /// Lists all subscriptions of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagApiLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagApiLinkRestOperations.cs new file mode 100644 index 000000000000..d6ac411ca915 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagApiLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class TagApiLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TagApiLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public TagApiLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the API link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the API link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, TagApiLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an API to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an API to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagOperationLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagOperationLinkRestOperations.cs new file mode 100644 index 000000000000..55d6709bb9ab --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagOperationLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class TagOperationLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TagOperationLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public TagOperationLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operation links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operation links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the operation link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagOperationLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the operation link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagOperationLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, TagOperationLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an operation to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagOperationLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an operation to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagOperationLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified operation from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified operation from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operation links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operation links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagProductLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagProductLinkRestOperations.cs new file mode 100644 index 000000000000..193c65b7d24b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagProductLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class TagProductLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TagProductLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public TagProductLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the product links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the product links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the product link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagProductLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the product link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagProductLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, TagProductLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds a product to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagProductLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds a product to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagProductLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified product from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified product from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the product links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the product links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagResourceRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagResourceRestOperations.cs index 57fea4d0dce9..2365a1aa4c0e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagResourceRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagResourceRestOperations.cs @@ -33,7 +33,7 @@ public TagResourceRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of resources associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists a collection of resources associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -150,8 +150,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of resources associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -184,8 +184,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists a collection of resources associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs index 44f31bfd504a..adb05c153fc0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs @@ -33,7 +33,7 @@ public TagRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoi { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByOperationRequest(string subscriptionId, string } /// Lists all Tags associated with the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -111,8 +111,8 @@ public async Task> ListByOperationAsync(string subscript } /// Lists all Tags associated with the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -173,8 +173,8 @@ internal HttpMessage CreateGetEntityStateByOperationRequest(string subscriptionI } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -211,8 +211,8 @@ public async Task> GetEntityStateByOperationAsync(string subscrip } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -275,8 +275,8 @@ internal HttpMessage CreateGetByOperationRequest(string subscriptionId, string r } /// Get tag associated with the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -312,8 +312,8 @@ public async Task> GetByOperationAsync(string subscrip } /// Get tag associated with the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -375,8 +375,8 @@ internal HttpMessage CreateAssignToOperationRequest(string subscriptionId, strin } /// Assign tag to the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -411,8 +411,8 @@ public async Task> AssignToOperationAsync(string subsc } /// Assign tag to the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -473,8 +473,8 @@ internal HttpMessage CreateDetachFromOperationRequest(string subscriptionId, str } /// Detach the tag from the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -504,8 +504,8 @@ public async Task DetachFromOperationAsync(string subscriptionId, stri } /// Detach the tag from the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -570,8 +570,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Lists all Tags associated with the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -604,8 +604,8 @@ public async Task> ListByApiAsync(string subscriptionId, } /// Lists all Tags associated with the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -662,8 +662,8 @@ internal HttpMessage CreateGetEntityStateByApiRequest(string subscriptionId, str } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag identifier. Must be unique in the current API Management service instance. @@ -698,8 +698,8 @@ public async Task> GetEntityStateByApiAsync(string subscriptionId } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag identifier. Must be unique in the current API Management service instance. @@ -758,8 +758,8 @@ internal HttpMessage CreateGetByApiRequest(string subscriptionId, string resourc } /// Get tag associated with the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag identifier. Must be unique in the current API Management service instance. @@ -793,8 +793,8 @@ public async Task> GetByApiAsync(string subscriptionId } /// Get tag associated with the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag identifier. Must be unique in the current API Management service instance. @@ -852,8 +852,8 @@ internal HttpMessage CreateAssignToApiRequest(string subscriptionId, string reso } /// Assign tag to the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag identifier. Must be unique in the current API Management service instance. @@ -886,8 +886,8 @@ public async Task> AssignToApiAsync(string subscriptio } /// Assign tag to the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag identifier. Must be unique in the current API Management service instance. @@ -944,8 +944,8 @@ internal HttpMessage CreateDetachFromApiRequest(string subscriptionId, string re } /// Detach the tag from the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag identifier. Must be unique in the current API Management service instance. @@ -973,8 +973,8 @@ public async Task DetachFromApiAsync(string subscriptionId, string res } /// Detach the tag from the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1037,8 +1037,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Lists all Tags associated with the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -1071,8 +1071,8 @@ public async Task> ListByProductAsync(string subscriptio } /// Lists all Tags associated with the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -1129,8 +1129,8 @@ internal HttpMessage CreateGetEntityStateByProductRequest(string subscriptionId, } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1165,8 +1165,8 @@ public async Task> GetEntityStateByProductAsync(string subscripti } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1225,8 +1225,8 @@ internal HttpMessage CreateGetByProductRequest(string subscriptionId, string res } /// Get tag associated with the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1260,8 +1260,8 @@ public async Task> GetByProductAsync(string subscripti } /// Get tag associated with the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1319,8 +1319,8 @@ internal HttpMessage CreateAssignToProductRequest(string subscriptionId, string } /// Assign tag to the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1353,8 +1353,8 @@ public async Task> AssignToProductAsync(string subscri } /// Assign tag to the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1411,8 +1411,8 @@ internal HttpMessage CreateDetachFromProductRequest(string subscriptionId, strin } /// Detach the tag from the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1440,8 +1440,8 @@ public async Task DetachFromProductAsync(string subscriptionId, string } /// Detach the tag from the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1506,8 +1506,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of tags defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -1539,8 +1539,8 @@ public async Task> ListByServiceAsync(string subscriptio } /// Lists a collection of tags defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -1594,8 +1594,8 @@ internal HttpMessage CreateGetEntityStateRequest(string subscriptionId, string r } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -1628,8 +1628,8 @@ public async Task> GetEntityStateAsync(string subscriptionId, str } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -1684,8 +1684,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -1717,8 +1717,8 @@ public async Task> GetAsync(string subscriptionId, str } /// Gets the details of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -1780,8 +1780,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a tag. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// Create parameters. @@ -1815,8 +1815,8 @@ public async Task> CreateOrUpdateAsync(string subscrip } /// Creates a tag. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// Create parameters. @@ -1877,8 +1877,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -1911,8 +1911,8 @@ public async Task> UpdateAsync(string subscriptionId, } /// Updates the details of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -1968,8 +1968,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific tag of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -1996,8 +1996,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific tag of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -2039,8 +2039,8 @@ internal HttpMessage CreateListByOperationNextPageRequest(string nextLink, strin /// Lists all Tags associated with the Operation. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -2077,8 +2077,8 @@ public async Task> ListByOperationNextPageAsync(string n /// Lists all Tags associated with the Operation. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -2129,8 +2129,8 @@ internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subs /// Lists all Tags associated with the API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -2165,8 +2165,8 @@ public async Task> ListByApiNextPageAsync(string nextLin /// Lists all Tags associated with the API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -2215,8 +2215,8 @@ internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string /// Lists all Tags associated with the Product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -2251,8 +2251,8 @@ public async Task> ListByProductNextPageAsync(string nex /// Lists all Tags associated with the Product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -2301,8 +2301,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of tags defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -2336,8 +2336,8 @@ public async Task> ListByServiceNextPageAsync(string nex /// Lists a collection of tags defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessGitRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessGitRestOperations.cs index 4b9d9b541f04..f0d51d6d6c63 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessGitRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessGitRestOperations.cs @@ -32,7 +32,7 @@ public TenantAccessGitRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -60,8 +60,8 @@ internal HttpMessage CreateRegeneratePrimaryKeyRequest(string subscriptionId, st } /// Regenerate primary access key for GIT. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -85,8 +85,8 @@ public async Task RegeneratePrimaryKeyAsync(string subscriptionId, str } /// Regenerate primary access key for GIT. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -133,8 +133,8 @@ internal HttpMessage CreateRegenerateSecondaryKeyRequest(string subscriptionId, } /// Regenerate secondary access key for GIT. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -158,8 +158,8 @@ public async Task RegenerateSecondaryKeyAsync(string subscriptionId, s } /// Regenerate secondary access key for GIT. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs index 2975ded82549..0b0f4b1d262b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs @@ -33,7 +33,7 @@ public TenantAccessRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Returns list of access infos - for Git and Management endpoints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -93,8 +93,8 @@ public async Task> ListByServiceAsync(stri } /// Returns list of access infos - for Git and Management endpoints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -145,8 +145,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Tenant access metadata. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -178,8 +178,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Tenant access metadata. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -233,8 +233,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get tenant access information details without secrets. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -265,8 +265,8 @@ public async Task> GetAsync(string subscriptionId } /// Get tenant access information details without secrets. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -324,8 +324,8 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Update tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -357,8 +357,8 @@ public async Task> CreateAsync(string subscriptio } /// Update tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -417,8 +417,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -450,8 +450,8 @@ public async Task> UpdateAsync(string subscriptio } /// Update tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -506,8 +506,8 @@ internal HttpMessage CreateRegeneratePrimaryKeyRequest(string subscriptionId, st } /// Regenerate primary access key. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -531,8 +531,8 @@ public async Task RegeneratePrimaryKeyAsync(string subscriptionId, str } /// Regenerate primary access key. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -579,8 +579,8 @@ internal HttpMessage CreateRegenerateSecondaryKeyRequest(string subscriptionId, } /// Regenerate secondary access key. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -604,8 +604,8 @@ public async Task RegenerateSecondaryKeyAsync(string subscriptionId, s } /// Regenerate secondary access key. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -652,8 +652,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Get tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -682,8 +682,8 @@ public async Task> ListSecretsAsync(str } /// Get tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -727,8 +727,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Returns list of access infos - for Git and Management endpoints. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -759,8 +759,8 @@ public async Task> ListByServiceNextPageAs /// Returns list of access infos - for Git and Management endpoints. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs index c6efc569762b..1c8a465ff121 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs @@ -33,7 +33,7 @@ public TenantConfigurationRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -65,8 +65,8 @@ internal HttpMessage CreateDeployRequest(string subscriptionId, string resourceG } /// This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Deploy Configuration parameters. @@ -93,8 +93,8 @@ public async Task DeployAsync(string subscriptionId, string resourceGr } /// This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Deploy Configuration parameters. @@ -148,8 +148,8 @@ internal HttpMessage CreateSaveRequest(string subscriptionId, string resourceGro } /// This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Save Configuration parameters. @@ -176,8 +176,8 @@ public async Task SaveAsync(string subscriptionId, string resourceGrou } /// This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Save Configuration parameters. @@ -231,8 +231,8 @@ internal HttpMessage CreateValidateRequest(string subscriptionId, string resourc } /// This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Validate Configuration parameters. @@ -259,8 +259,8 @@ public async Task ValidateAsync(string subscriptionId, string resource } /// This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Validate Configuration parameters. @@ -310,8 +310,8 @@ internal HttpMessage CreateGetSyncStateRequest(string subscriptionId, string res } /// Gets the status of the most recent synchronization between the configuration database and the Git repository. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// The cancellation token to use. @@ -340,8 +340,8 @@ public async Task> GetSyncStateAs } /// Gets the status of the most recent synchronization between the configuration database and the Git repository. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantSettingsRestOperations.cs index 716f1a88f70d..aad515b286eb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantSettingsRestOperations.cs @@ -33,7 +33,7 @@ public TenantSettingsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Public settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -93,8 +93,8 @@ public async Task> ListByServiceAsync(string } /// Public settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -145,8 +145,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get tenant settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the settings. /// The cancellation token to use. @@ -177,8 +177,8 @@ public async Task> GetAsync(string subs } /// Get tenant settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the settings. /// The cancellation token to use. @@ -224,8 +224,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Public settings. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -256,8 +256,8 @@ public async Task> ListByServiceNextPageAsync /// Public settings. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserConfirmationPasswordRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserConfirmationPasswordRestOperations.cs index 4f06d21ceedb..66af9a345896 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserConfirmationPasswordRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserConfirmationPasswordRestOperations.cs @@ -32,7 +32,7 @@ public UserConfirmationPasswordRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -64,8 +64,8 @@ internal HttpMessage CreateSendRequest(string subscriptionId, string resourceGro } /// Sends confirmation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Determines the type of application which send the create user request. Default is legacy publisher portal. @@ -91,8 +91,8 @@ public async Task SendAsync(string subscriptionId, string resourceGrou } /// Sends confirmation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Determines the type of application which send the create user request. Default is legacy publisher portal. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserGroupRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserGroupRestOperations.cs index 5ac160d40908..b4ac6fa57d1e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserGroupRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserGroupRestOperations.cs @@ -33,7 +33,7 @@ public UserGroupRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists all user groups. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListAsync(string subscriptionId, st } /// Lists all user groups. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -156,8 +156,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists all user groups. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -192,8 +192,8 @@ public async Task> ListNextPageAsync(string nextLink, /// Lists all user groups. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserIdentitiesRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserIdentitiesRestOperations.cs index 5aa72d7280fe..78677ffc7f61 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserIdentitiesRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserIdentitiesRestOperations.cs @@ -33,7 +33,7 @@ public UserIdentitiesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// List of all user identities. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -92,8 +92,8 @@ public async Task> ListAsync(string subscriptio } /// List of all user identities. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -138,8 +138,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// List of all user identities. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -171,8 +171,8 @@ public async Task> ListNextPageAsync(string nex /// List of all user identities. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs index 21bad12034a8..d0da4457590c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs @@ -33,7 +33,7 @@ public UserRestOperations(HttpPipeline pipeline, string applicationId, Uri endpo { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of registered users in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -108,8 +108,8 @@ public async Task> ListByServiceAsync(string subscripti } /// Lists a collection of registered users in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -163,8 +163,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -197,8 +197,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -253,8 +253,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -286,8 +286,8 @@ public async Task> GetAsync(string subscriptionId, st } /// Gets the details of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -353,8 +353,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -389,8 +389,8 @@ public async Task> CreateOrUpdateAsync(string subscri } /// Creates or Updates a user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -452,8 +452,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -486,8 +486,8 @@ public async Task> UpdateAsync(string subscriptionId, } /// Updates the details of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -555,8 +555,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -577,7 +577,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: + case 202: case 204: return message.Response; default: @@ -586,8 +586,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -608,7 +608,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: + case 202: case 204: return message.Response; default: @@ -640,8 +640,8 @@ internal HttpMessage CreateGenerateSsoUriRequest(string subscriptionId, string r } /// Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -671,8 +671,8 @@ public async Task> GenerateSsoUriAsync(string sub } /// Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -729,8 +729,8 @@ internal HttpMessage CreateGetSharedAccessTokenRequest(string subscriptionId, st } /// Gets the Shared Access Authorization Token for the User. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Create Authorization Token parameters. @@ -762,8 +762,8 @@ public async Task> GetSharedAccessTokenAsync(string su } /// Gets the Shared Access Authorization Token for the User. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Create Authorization Token parameters. @@ -810,8 +810,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of registered users in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -845,8 +845,8 @@ public async Task> ListByServiceNextPageAsync(string ne /// Lists a collection of registered users in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| groups | expand | | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserSubscriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserSubscriptionRestOperations.cs index d8a7946a3c63..0f221c9d8d43 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserSubscriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserSubscriptionRestOperations.cs @@ -33,7 +33,7 @@ public UserSubscriptionRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists the collection of subscriptions of the specified user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>|name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListAsync(string subscriptio } /// Lists the collection of subscriptions of the specified user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>|name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the specified Subscription entity associated with a particular user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. @@ -200,8 +200,8 @@ public async Task> GetAsync(string subscripti } /// Gets the specified Subscription entity associated with a particular user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. @@ -250,8 +250,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists the collection of subscriptions of the specified user. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>|name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -286,8 +286,8 @@ public async Task> ListNextPageAsync(string nex /// Lists the collection of subscriptions of the specified user. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>|name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationPolicyRestOperations.cs new file mode 100644 index 000000000000..512404dd7ced --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationPolicyRestOperations.cs @@ -0,0 +1,652 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiOperationPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiOperationPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiOperationPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByOperationRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of policy configuration at the API Operation level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByOperationAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateListByOperationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of policy configuration at the API Operation level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response ListByOperation(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateListByOperationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the API Operation level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the API Operation level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the API Operation level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the API Operation level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the Api Operation. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the Api Operation. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByOperationNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of policy configuration at the API Operation level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByOperationNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateListByOperationNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of policy configuration at the API Operation level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response ListByOperationNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateListByOperationNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationRestOperations.cs new file mode 100644 index 000000000000..db1548b8e26a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationRestOperations.cs @@ -0,0 +1,759 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiOperationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiOperationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiOperationRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip, string tags) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operations for the specified API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip, tags); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operations for the specified API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip, tags); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the API operation specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the API operation specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the API Operation specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiOperationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiOperationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the API Operation specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiOperationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiOperationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ApiOperationData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new operation in the API or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiOperationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new operation in the API or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiOperationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(operationUpdateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the operation in the API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Operation Update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, ifMatch, operationUpdateContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiOperationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the operation in the API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Operation Update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, ifMatch, operationUpdateContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiOperationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified operation in the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified operation in the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip, string tags) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operations for the specified API. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip, tags); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operations for the specified API. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApiNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip, tags); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiPolicyRestOperations.cs new file mode 100644 index 000000000000..74ede4342af1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiPolicyRestOperations.cs @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the API policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the API policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the Api. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the Api. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the API level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the API level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApiNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiReleaseRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiReleaseRestOperations.cs new file mode 100644 index 000000000000..bbf9aa79066f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiReleaseRestOperations.cs @@ -0,0 +1,751 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiReleaseRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiReleaseRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiReleaseRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseListResult.DeserializeApiReleaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseListResult.DeserializeApiReleaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the etag of an API release. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the etag of an API release. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the details of an API release. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiReleaseData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the details of an API release. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiReleaseData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ApiReleaseData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new Release for the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiReleaseData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new Release for the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiReleaseData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, ApiReleaseData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the release of the API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Release Update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, ifMatch, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the release of the API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Release Update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, ifMatch, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified release in the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified release in the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseListResult.DeserializeApiReleaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseListResult.DeserializeApiReleaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRestOperations.cs new file mode 100644 index 000000000000..2ab16c148802 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRestOperations.cs @@ -0,0 +1,723 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, string tags, bool? expandApiVersionSet) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + if (expandApiVersionSet != null) + { + uri.AppendQuery("expandApiVersionSet", expandApiVersionSet.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all APIs of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, tags, expandApiVersionSet); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiListResult.DeserializeApiListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all APIs of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, tags, expandApiVersionSet); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiListResult.DeserializeApiListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiData.DeserializeApiData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the API specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiData.DeserializeApiData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiCreateOrUpdateParameter); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates new or updates existing specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, apiCreateOrUpdateParameter, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates new or updates existing specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, apiCreateOrUpdateParameter, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiUpdateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Update Contract parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, ifMatch, apiUpdateContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiData.DeserializeApiData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Update Contract parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, ifMatch, apiUpdateContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiData.DeserializeApiData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, bool? deleteRevisions) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + if (deleteRevisions != null) + { + uri.AppendQuery("deleteRevisions", deleteRevisions.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Delete all revisions of the Api. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, ifMatch, deleteRevisions); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Delete all revisions of the Api. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, ifMatch, deleteRevisions); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, string tags, bool? expandApiVersionSet) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all APIs of the workspace in an API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, tags, expandApiVersionSet); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiListResult.DeserializeApiListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all APIs of the workspace in an API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, tags, expandApiVersionSet); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiListResult.DeserializeApiListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRevisionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRevisionRestOperations.cs new file mode 100644 index 000000000000..4db4433cf55e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRevisionRestOperations.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiRevisionRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiRevisionRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiRevisionRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/revisions", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all revisions of an API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiRevisionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiRevisionListResult.DeserializeApiRevisionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all revisions of an API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiRevisionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiRevisionListResult.DeserializeApiRevisionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all revisions of an API. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiRevisionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiRevisionListResult.DeserializeApiRevisionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all revisions of an API. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiRevisionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiRevisionListResult.DeserializeApiRevisionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiSchemaRestOperations.cs new file mode 100644 index 000000000000..b03f22ded995 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiSchemaRestOperations.cs @@ -0,0 +1,640 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiSchemaRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiSchemaRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiSchemaRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the schema configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the schema configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the schema specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the schema specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the schema configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiSchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the schema configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiSchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ApiSchemaData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates schema configuration for the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates schema configuration for the API. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ETag ifMatch, bool? force) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + if (force != null) + { + uri.AppendQuery("force", force.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the schema configuration at the Api. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// If true removes all references to the schema before deleting it. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId, ifMatch, force); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the schema configuration at the Api. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// If true removes all references to the schema before deleting it. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId, ifMatch, force); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the schema configuration at the API level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the schema configuration at the API level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApiNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiVersionSetRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiVersionSetRestOperations.cs new file mode 100644 index 000000000000..b4e24ba64236 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiVersionSetRestOperations.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiVersionSetRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiVersionSetRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiVersionSetRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetListResult.DeserializeApiVersionSetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetListResult.DeserializeApiVersionSetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Api Version Set specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiVersionSetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Api Version Set specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiVersionSetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ApiVersionSetData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or Updates a Api Version Set. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiVersionSetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or Updates a Api Version Set. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiVersionSetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiVersionSetUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the Api VersionSet specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, ifMatch, apiVersionSetUpdateParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the Api VersionSet specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, ifMatch, apiVersionSetUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific Api Version Set. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific Api Version Set. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetListResult.DeserializeApiVersionSetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetListResult.DeserializeApiVersionSetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGlobalSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGlobalSchemaRestOperations.cs new file mode 100644 index 000000000000..f5a1dbe96097 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGlobalSchemaRestOperations.cs @@ -0,0 +1,600 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceGlobalSchemaRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceGlobalSchemaRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceGlobalSchemaRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of schemas registered with workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GlobalSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GlobalSchemaListResult.DeserializeGlobalSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of schemas registered with workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GlobalSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GlobalSchemaListResult.DeserializeGlobalSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Schema specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Schema specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Schema specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGlobalSchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementGlobalSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Schema specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGlobalSchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementGlobalSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific Schema. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of schemas registered with workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GlobalSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GlobalSchemaListResult.DeserializeGlobalSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of schemas registered with workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GlobalSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GlobalSchemaListResult.DeserializeGlobalSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupRestOperations.cs new file mode 100644 index 000000000000..6b6269e99e9d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupRestOperations.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceGroupRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceGroupRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceGroupRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of groups defined within a workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupListResult.DeserializeGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of groups defined within a workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupListResult.DeserializeGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the group specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the group specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the group specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the group specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(groupCreateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or Updates a group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, groupCreateParameters, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiManagementGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or Updates a group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, groupCreateParameters, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiManagementGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(groupUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the group specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, ifMatch, groupUpdateParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the group specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, ifMatch, groupUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific group of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific group of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of groups defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupListResult.DeserializeGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of groups defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupListResult.DeserializeGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupUserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupUserRestOperations.cs new file mode 100644 index 000000000000..7ff3c3031967 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupUserRestOperations.cs @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceGroupUserRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceGroupUserRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceGroupUserRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/users", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of user entities associated with the group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of user entities associated with the group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Checks that user entity specified by identifier is associated with the group entity. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CheckEntityExistsAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Checks that user entity specified by identifier is associated with the group entity. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CheckEntityExists(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Add existing user to existing group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + UserContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UserContractData.DeserializeUserContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Add existing user to existing group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + UserContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UserContractData.DeserializeUserContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Remove existing user from existing group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Remove existing user from existing group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of user entities associated with the group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of user entities associated with the group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNamedValueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNamedValueRestOperations.cs new file mode 100644 index 000000000000..7f3c3e2a0d1e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNamedValueRestOperations.cs @@ -0,0 +1,875 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceNamedValueRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceNamedValueRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceNamedValueRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, KeyVaultRefreshState? isKeyVaultRefreshFailed) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (isKeyVaultRefreshFailed != null) + { + uri.AppendQuery("isKeyVaultRefreshFailed", isKeyVaultRefreshFailed.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of named values defined within a workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Query parameter to fetch named value entities based on refresh status. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, KeyVaultRefreshState? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, isKeyVaultRefreshFailed); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamedValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamedValueListResult.DeserializeNamedValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of named values defined within a workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Query parameter to fetch named value entities based on refresh status. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, KeyVaultRefreshState? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, isKeyVaultRefreshFailed); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamedValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamedValueListResult.DeserializeNamedValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the named value specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the named value specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the named value specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNamedValueData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementNamedValueData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the named value specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNamedValueData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementNamedValueData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(namedValueCreateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates named value. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, namedValueCreateContract, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates named value. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, namedValueCreateContract, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(namedValueUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the specific named value. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, ifMatch, namedValueUpdateParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the specific named value. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, ifMatch, namedValueUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific named value from the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific named value from the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListValueRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendPath("/listValue", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the secret of the named value specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListValueAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateListValueRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamedValueSecretContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamedValueSecretContract.DeserializeNamedValueSecretContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the secret of the named value specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListValue(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateListValueRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamedValueSecretContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamedValueSecretContract.DeserializeNamedValueSecretContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRefreshSecretRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendPath("/refreshSecret", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Refresh the secret of the named value specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task RefreshSecretAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateRefreshSecretRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Refresh the secret of the named value specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response RefreshSecret(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateRefreshSecretRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, KeyVaultRefreshState? isKeyVaultRefreshFailed) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of named values defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Query parameter to fetch named value entities based on refresh status. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, KeyVaultRefreshState? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, isKeyVaultRefreshFailed); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamedValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamedValueListResult.DeserializeNamedValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of named values defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Query parameter to fetch named value entities based on refresh status. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, KeyVaultRefreshState? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, isKeyVaultRefreshFailed); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamedValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamedValueListResult.DeserializeNamedValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientEmailRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientEmailRestOperations.cs new file mode 100644 index 000000000000..74121b113529 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientEmailRestOperations.cs @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceNotificationRecipientEmailRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceNotificationRecipientEmailRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceNotificationRecipientEmailRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByNotificationRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientEmails", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of the Notification Recipient Emails subscribed to a notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNotificationAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByNotificationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RecipientEmailListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecipientEmailListResult.DeserializeRecipientEmailListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of the Notification Recipient Emails subscribed to a notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNotification(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByNotificationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RecipientEmailListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecipientEmailListResult.DeserializeRecipientEmailListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientEmails/", false); + uri.AppendPath(email, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Determine if Notification Recipient Email subscribed to the notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CheckEntityExistsAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Determine if Notification Recipient Email subscribed to the notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CheckEntityExists(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientEmails/", false); + uri.AppendPath(email, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Adds the Email address to the list of Recipients for the Notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + RecipientEmailContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecipientEmailContract.DeserializeRecipientEmailContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds the Email address to the list of Recipients for the Notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + RecipientEmailContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecipientEmailContract.DeserializeRecipientEmailContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientEmails/", false); + uri.AppendPath(email, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Removes the email from the list of Notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Removes the email from the list of Notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientUserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientUserRestOperations.cs new file mode 100644 index 000000000000..fc0c3ec0c564 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientUserRestOperations.cs @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceNotificationRecipientUserRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceNotificationRecipientUserRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceNotificationRecipientUserRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByNotificationRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientUsers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of the Notification Recipient User subscribed to the notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNotificationAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByNotificationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RecipientUserListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecipientUserListResult.DeserializeRecipientUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of the Notification Recipient User subscribed to the notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNotification(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByNotificationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RecipientUserListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecipientUserListResult.DeserializeRecipientUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientUsers/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Determine if the Notification Recipient User is subscribed to the notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CheckEntityExistsAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Determine if the Notification Recipient User is subscribed to the notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CheckEntityExists(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientUsers/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Adds the API Management User to the list of Recipients for the Notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + RecipientUserContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecipientUserContract.DeserializeRecipientUserContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds the API Management User to the list of Recipients for the Notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + RecipientUserContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecipientUserContract.DeserializeRecipientUserContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientUsers/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Removes the API Management user from the list of Notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Removes the API Management user from the list of Notification. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRestOperations.cs new file mode 100644 index 000000000000..ac87188551e0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRestOperations.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceNotificationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceNotificationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceNotificationRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of properties defined within a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotificationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotificationListResult.DeserializeNotificationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of properties defined within a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotificationListResult.DeserializeNotificationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Notification specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNotificationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementNotificationData.DeserializeApiManagementNotificationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementNotificationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Notification specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNotificationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementNotificationData.DeserializeApiManagementNotificationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementNotificationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Create or Update API Management publisher notification for the workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNotificationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementNotificationData.DeserializeApiManagementNotificationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or Update API Management publisher notification for the workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNotificationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementNotificationData.DeserializeApiManagementNotificationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of properties defined within a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotificationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotificationListResult.DeserializeNotificationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of properties defined within a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotificationListResult.DeserializeNotificationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyFragmentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyFragmentRestOperations.cs new file mode 100644 index 000000000000..b7be53d71c60 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyFragmentRestOperations.cs @@ -0,0 +1,717 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspacePolicyFragmentRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspacePolicyFragmentRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspacePolicyFragmentRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, string orderBy, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all policy fragments defined within a workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, orderBy, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all policy fragments defined within a workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, orderBy, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContentFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyFragmentContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyFragmentContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListReferencesRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendPath("/listReferences", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists policy resources that reference the policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListReferencesAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateListReferencesRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists policy resources that reference the policy fragment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListReferences(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateListReferencesRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, string orderBy, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all policy fragments defined within a workspace. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, orderBy, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all policy fragments defined within a workspace. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, orderBy, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyRestOperations.cs new file mode 100644 index 000000000000..894cc16dbb95 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyRestOperations.cs @@ -0,0 +1,584 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspacePolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspacePolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspacePolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the workspace level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the workspace level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the workspace policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the workspace policy specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the workspace level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the workspace level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApiNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductApiLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductApiLinkRestOperations.cs new file mode 100644 index 000000000000..26cf4476d7d8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductApiLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceProductApiLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceProductApiLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceProductApiLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the API link for the product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the API link for the product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, ProductApiLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an API to the specified product via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an API to the specified product via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API from the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API from the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductGroupLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductGroupLinkRestOperations.cs new file mode 100644 index 000000000000..8b86f7b9fa48 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductGroupLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceProductGroupLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceProductGroupLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceProductGroupLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the group links associated with a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the group links associated with a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the group link for the product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductGroupLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the group link for the product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductGroupLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, ProductGroupLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds a group to the specified product via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductGroupLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds a group to the specified product via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductGroupLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified group from the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified group from the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the group links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the group links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductPolicyRestOperations.cs new file mode 100644 index 000000000000..4f2bbc1e417c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductPolicyRestOperations.cs @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceProductPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceProductPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceProductPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the Product level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the Product level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the ETag of the policy configuration at the Product level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the ETag of the policy configuration at the Product level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the Product level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the Product level. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the Product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the Product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the Product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the Product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductRestOperations.cs new file mode 100644 index 000000000000..85c31a3d5f77 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductRestOperations.cs @@ -0,0 +1,733 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceProductRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceProductRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceProductRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, bool? expandGroups, string tags) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (expandGroups != null) + { + uri.AppendQuery("expandGroups", expandGroups.Value, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of products in the specified workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, expandGroups, tags); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductListResult.DeserializeProductListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of products in the specified workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, expandGroups, tags); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductListResult.DeserializeProductListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementProductData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementProductData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the product specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementProductData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementProductData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ApiManagementProductData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or Updates a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiManagementProductData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or Updates a product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiManagementProductData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(productUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update existing product details. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, ifMatch, productUpdateParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementProductData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update existing product details. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, ifMatch, productUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementProductData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, bool? deleteSubscriptions) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + if (deleteSubscriptions != null) + { + uri.AppendQuery("deleteSubscriptions", deleteSubscriptions.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Delete existing subscriptions associated with the product or not. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, ifMatch, deleteSubscriptions); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Delete existing subscriptions associated with the product or not. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, ifMatch, deleteSubscriptions); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, bool? expandGroups, string tags) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of products in the specified workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, expandGroups, tags); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductListResult.DeserializeProductListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of products in the specified workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, expandGroups, tags); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductListResult.DeserializeProductListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceRestOperations.cs new file mode 100644 index 000000000000..486f68b00c6e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceRestOperations.cs @@ -0,0 +1,671 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all workspaces of the API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceListResult.DeserializeWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all workspaces of the API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceListResult.DeserializeWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the workspace specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the workspace specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the workspace specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkspaceContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkspaceContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the workspace specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkspaceContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkspaceContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, WorkspaceContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new workspace or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, WorkspaceContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + WorkspaceContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new workspace or updates an existing one. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, WorkspaceContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + WorkspaceContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, WorkspaceContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the workspace specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Workspace Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, WorkspaceContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, ifMatch, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkspaceContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the workspace specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Workspace Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, WorkspaceContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, ifMatch, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkspaceContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all workspaces of the API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceListResult.DeserializeWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all workspaces of the API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceListResult.DeserializeWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceSubscriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceSubscriptionRestOperations.cs new file mode 100644 index 000000000000..1c4accb8f5c1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceSubscriptionRestOperations.cs @@ -0,0 +1,1004 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceSubscriptionRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceSubscriptionRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceSubscriptionRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all subscriptions of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all subscriptions of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified Subscription entity. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SubscriptionContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified Subscription entity. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SubscriptionContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify, ETag? ifMatch, AppType? appType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + if (notify != null) + { + uri.AppendQuery("notify", notify.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + if (appType != null) + { + uri.AppendQuery("appType", appType.Value.ToString(), true); + } + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(subscriptionCreateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates the subscription of specified user to the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// Create parameters. + /// + /// Notify change in Subscription State. + /// - If false, do not send any email notification for change of state of subscription + /// - If true, send email notification of change of state of subscription + /// + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, subscriptionCreateParameters, notify, ifMatch, appType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + SubscriptionContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates the subscription of specified user to the specified product. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// Create parameters. + /// + /// Notify change in Subscription State. + /// - If false, do not send any email notification for change of state of subscription + /// - If true, send email notification of change of state of subscription + /// + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, subscriptionCreateParameters, notify, ifMatch, appType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + SubscriptionContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify, AppType? appType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + if (notify != null) + { + uri.AppendQuery("notify", notify.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + if (appType != null) + { + uri.AppendQuery("appType", appType.Value.ToString(), true); + } + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(subscriptionUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of a subscription specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// + /// Notify change in Subscription State. + /// - If false, do not send any email notification for change of state of subscription + /// - If true, send email notification of change of state of subscription + /// + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, ifMatch, subscriptionUpdateParameters, notify, appType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of a subscription specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// + /// Notify change in Subscription State. + /// - If false, do not send any email notification for change of state of subscription + /// - If true, send email notification of change of state of subscription + /// + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, ifMatch, subscriptionUpdateParameters, notify, appType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRegeneratePrimaryKeyRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendPath("/regeneratePrimaryKey", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Regenerates primary key of existing subscription of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task RegeneratePrimaryKeyAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateRegeneratePrimaryKeyRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Regenerates primary key of existing subscription of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response RegeneratePrimaryKey(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateRegeneratePrimaryKeyRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRegenerateSecondaryKeyRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendPath("/regenerateSecondaryKey", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Regenerates secondary key of existing subscription of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task RegenerateSecondaryKeyAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateRegenerateSecondaryKeyRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Regenerates secondary key of existing subscription of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response RegenerateSecondaryKey(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateRegenerateSecondaryKeyRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSecretsRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendPath("/listSecrets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified Subscription keys. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListSecretsAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateListSecretsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionKeysContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionKeysContract.DeserializeSubscriptionKeysContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified Subscription keys. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListSecrets(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateListSecretsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionKeysContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionKeysContract.DeserializeSubscriptionKeysContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all subscriptions of the workspace in an API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all subscriptions of the workspace in an API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagApiLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagApiLinkRestOperations.cs new file mode 100644 index 000000000000..1dcd368cc91c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagApiLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceTagApiLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceTagApiLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceTagApiLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the API link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the API link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, TagApiLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an API to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an API to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagOperationLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagOperationLinkRestOperations.cs new file mode 100644 index 000000000000..4f7e63d2d8f3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagOperationLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceTagOperationLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceTagOperationLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceTagOperationLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operation links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operation links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the operation link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagOperationLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the operation link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagOperationLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, TagOperationLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an operation to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagOperationLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an operation to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagOperationLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified operation from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified operation from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operation links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operation links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagProductLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagProductLinkRestOperations.cs new file mode 100644 index 000000000000..d4454cc179b5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagProductLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceTagProductLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceTagProductLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceTagProductLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the product links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the product links associated with a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the product link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagProductLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the product link for the tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagProductLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, TagProductLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds a product to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagProductLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds a product to the specified tag via link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagProductLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified product from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified product from the specified tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the product links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the product links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagRestOperations.cs new file mode 100644 index 000000000000..35854cfd6a9b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagRestOperations.cs @@ -0,0 +1,719 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceTagRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceTagRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceTagRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, string scope) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (scope != null) + { + uri.AppendQuery("scope", scope, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of tags defined within a workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, scope); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagListResult.DeserializeTagListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of tags defined within a workspace in a service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, scope); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagListResult.DeserializeTagListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityStateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state version of the tag specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityStateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateGetEntityStateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state version of the tag specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityState(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateGetEntityStateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the tag specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the tag specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Creates a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, content, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a tag. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, content, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, ApiManagementTagCreateOrUpdateContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the tag specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, ApiManagementTagCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, ifMatch, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the tag specified by its identifier. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, ApiManagementTagCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, ifMatch, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific tag of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific tag of the workspace in an API Management service instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, string scope) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of tags defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, scope); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagListResult.DeserializeTagListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of tags defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, scope); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagListResult.DeserializeTagListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiCollection.cs similarity index 68% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiCollection.cs index d3c523b5254e..2d63299df3f2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiCollection.cs @@ -21,28 +21,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApis method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApis method from an instance of . /// - public partial class ApiCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiClientDiagnostics; - private readonly ApiRestOperations _apiRestClient; + private readonly ClientDiagnostics _serviceApiApiClientDiagnostics; + private readonly ApiRestOperations _serviceApiApiRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiResource.ResourceType, out string apiApiVersion); - _apiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiApiVersion); + _serviceApiApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiResource.ResourceType, out string serviceApiApiApiVersion); + _serviceApiApiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiApiApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -69,22 +69,22 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. - /// Create or update parameters. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.CreateOrUpdate"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, content, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiOperationSource(Client), _apiClientDiagnostics, Pipeline, _apiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, content, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceApiApiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceApiOperationSource(Client), _serviceApiApiClientDiagnostics, Pipeline, _serviceApiApiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -111,22 +111,22 @@ public virtual async Task> CreateOrUpdateAsync(WaitUnt /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. - /// Create or update parameters. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.CreateOrUpdate"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, content, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiOperationSource(Client), _apiClientDiagnostics, Pipeline, _apiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, content, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceApiApiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceApiOperationSource(Client), _serviceApiApiClientDiagnostics, Pipeline, _serviceApiApiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -155,18 +155,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, str /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string apiId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string apiId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.Get"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.Get"); scope.Start(); try { - var response = await _apiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -192,18 +192,18 @@ public virtual async Task> GetAsync(string apiId, Cancella /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string apiId, CancellationToken cancellationToken = default) + public virtual Response Get(string apiId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.Get"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.Get"); scope.Start(); try { - var response = _apiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken); + var response = _serviceApiApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -231,12 +231,12 @@ public virtual Response Get(string apiId, CancellationToken cancell /// Include tags in the response. /// Include full ApiVersionSet resource in response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiResource(Client, ApiData.DeserializeApiData(e)), _apiClientDiagnostics, Pipeline, "ApiCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiApiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiApiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiResource(Client, ApiData.DeserializeApiData(e)), _serviceApiApiClientDiagnostics, Pipeline, "ServiceApiCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,12 +258,12 @@ public virtual AsyncPageable GetAllAsync(string filter = null, int? /// Include tags in the response. /// Include full ApiVersionSet resource in response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiResource(Client, ApiData.DeserializeApiData(e)), _apiClientDiagnostics, Pipeline, "ApiCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiApiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiApiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiResource(Client, ApiData.DeserializeApiData(e)), _serviceApiApiClientDiagnostics, Pipeline, "ServiceApiCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -287,11 +287,11 @@ public virtual async Task> ExistsAsync(string apiId, Cancellation { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.Exists"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.Exists"); scope.Start(); try { - var response = await _apiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -322,11 +322,11 @@ public virtual Response Exists(string apiId, CancellationToken cancellatio { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.Exists"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.Exists"); scope.Start(); try { - var response = _apiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken); + var response = _serviceApiApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -353,18 +353,18 @@ public virtual Response Exists(string apiId, CancellationToken cancellatio /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string apiId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string apiId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.GetIfExists"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.GetIfExists"); scope.Start(); try { - var response = await _apiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -390,18 +390,18 @@ public virtual async Task> GetIfExistsAsync(string /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string apiId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string apiId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.GetIfExists"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.GetIfExists"); scope.Start(); try { - var response = _apiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken); + var response = _serviceApiApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -410,7 +410,7 @@ public virtual NullableResponse GetIfExists(string apiId, Cancellat } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -420,7 +420,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationCollection.cs similarity index 68% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationCollection.cs index 4aba46464fcd..19c82d9e92f6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiOperations method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiOperations method from an instance of . /// - public partial class ApiOperationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiOperationCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiOperationClientDiagnostics; - private readonly ApiOperationRestOperations _apiOperationRestClient; + private readonly ClientDiagnostics _serviceApiOperationApiOperationClientDiagnostics; + private readonly ApiOperationRestOperations _serviceApiOperationApiOperationRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiOperationCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiOperationCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiOperationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiOperationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiOperationResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiOperationResource.ResourceType, out string apiOperationApiVersion); - _apiOperationRestClient = new ApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiOperationApiVersion); + _serviceApiOperationApiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiOperationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiOperationResource.ResourceType, out string serviceApiOperationApiOperationApiVersion); + _serviceApiOperationApiOperationRestClient = new ApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiOperationApiOperationApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -49,8 +49,8 @@ internal ApiOperationCollection(ArmClient client, ResourceIdentifier id) : base( internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// @@ -73,17 +73,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.CreateOrUpdate"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiOperationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiOperationResource(Client, response), response.GetRawResponse())); + var response = await _serviceApiOperationApiOperationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiOperationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -115,17 +115,17 @@ public virtual async Task> CreateOrUpdateAsyn /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.CreateOrUpdate"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiOperationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiOperationResource(Client, response), response.GetRawResponse())); + var response = _serviceApiOperationApiOperationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiOperationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -154,18 +154,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitU /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string operationId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.Get"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.Get"); scope.Start(); try { - var response = await _apiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -191,18 +191,18 @@ public virtual async Task> GetAsync(string operat /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string operationId, CancellationToken cancellationToken = default) + public virtual Response Get(string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.Get"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.Get"); scope.Start(); try { - var response = _apiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -229,12 +229,12 @@ public virtual Response Get(string operationId, Cancellati /// Number of records to skip. /// Include tags in the response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _apiOperationClientDiagnostics, Pipeline, "ApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiOperationApiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiOperationApiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _serviceApiOperationApiOperationClientDiagnostics, Pipeline, "ServiceApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -255,12 +255,12 @@ public virtual AsyncPageable GetAllAsync(string filter = n /// Number of records to skip. /// Include tags in the response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _apiOperationClientDiagnostics, Pipeline, "ApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiOperationApiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiOperationApiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _serviceApiOperationApiOperationClientDiagnostics, Pipeline, "ServiceApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -284,11 +284,11 @@ public virtual async Task> ExistsAsync(string operationId, Cancel { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.Exists"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.Exists"); scope.Start(); try { - var response = await _apiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -319,11 +319,11 @@ public virtual Response Exists(string operationId, CancellationToken cance { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.Exists"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.Exists"); scope.Start(); try { - var response = _apiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -350,18 +350,18 @@ public virtual Response Exists(string operationId, CancellationToken cance /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string operationId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.GetIfExists"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.GetIfExists"); scope.Start(); try { - var response = await _apiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -387,18 +387,18 @@ public virtual async Task> GetIfExistsAsy /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string operationId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.GetIfExists"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.GetIfExists"); scope.Start(); try { - var response = _apiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -407,7 +407,7 @@ public virtual NullableResponse GetIfExists(string operati } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -417,7 +417,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationResource.cs similarity index 76% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationResource.cs index af3a0d473faf..f292454cb88a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationResource.cs @@ -18,14 +18,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiOperation along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiOperationResource method. - /// Otherwise you can get one from its parent resource using the GetApiOperation method. + /// A Class representing a ServiceApiOperation along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiOperationResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiOperation method. /// - public partial class ApiOperationResource : ArmResource + public partial class ServiceApiOperationResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -37,35 +37,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiOperationClientDiagnostics; - private readonly ApiOperationRestOperations _apiOperationRestClient; + private readonly ClientDiagnostics _serviceApiOperationApiOperationClientDiagnostics; + private readonly ApiOperationRestOperations _serviceApiOperationApiOperationRestClient; private readonly ApiOperationData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis/operations"; - /// Initializes a new instance of the class for mocking. - protected ApiOperationResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiOperationResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiOperationResource(ArmClient client, ApiOperationData data) : this(client, data.Id) + internal ServiceApiOperationResource(ArmClient client, ApiOperationData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiOperationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiOperationResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiOperationApiVersion); - _apiOperationRestClient = new ApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiOperationApiVersion); + _serviceApiOperationApiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiOperationApiOperationApiVersion); + _serviceApiOperationApiOperationRestClient = new ApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiOperationApiOperationApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -92,7 +92,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of ApiOperationPolicyResources in the ApiOperation. + /// Gets a collection of ApiOperationPolicyResources in the ServiceApiOperation. /// An object representing collection of ApiOperationPolicyResources and their operations over a ApiOperationPolicyResource. public virtual ApiOperationPolicyCollection GetApiOperationPolicies() { @@ -143,7 +143,7 @@ public virtual Response GetApiOperationPolicy(Policy return GetApiOperationPolicies().Get(policyId, format, cancellationToken); } - /// Gets a collection of ApiOperationTagResources in the ApiOperation. + /// Gets a collection of ApiOperationTagResources in the ServiceApiOperation. /// An object representing collection of ApiOperationTagResources and their operations over a ApiOperationTagResource. public virtual ApiOperationTagCollection GetApiOperationTags() { @@ -210,16 +210,16 @@ public virtual Response GetApiOperationTag(string tagId /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Get"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Get"); scope.Start(); try { - var response = await _apiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -242,16 +242,16 @@ public virtual async Task> GetAsync(CancellationT /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Get"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Get"); scope.Start(); try { - var response = _apiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -278,11 +278,11 @@ public virtual Response Get(CancellationToken cancellation /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Delete"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Delete"); scope.Start(); try { - var response = await _apiOperationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -313,11 +313,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Delete"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Delete"); scope.Start(); try { - var response = _apiOperationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -344,19 +344,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// API Operation Update parameters. + /// API Operation Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiOperationPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Update"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Update"); scope.Start(); try { - var response = await _apiOperationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceApiOperationApiOperationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, operationUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -379,19 +379,19 @@ public virtual async Task> UpdateAsync(ETag ifMat /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// API Operation Update parameters. + /// API Operation Update parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiOperationPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Update"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Update"); scope.Start(); try { - var response = _apiOperationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceApiOperationApiOperationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, operationUpdateContract, cancellationToken); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -416,11 +416,11 @@ public virtual Response Update(ETag ifMatch, ApiOperationP /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.GetEntityTag"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.GetEntityTag"); scope.Start(); try { - var response = await _apiOperationRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -446,11 +446,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.GetEntityTag"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.GetEntityTag"); scope.Start(); try { - var response = _apiOperationRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseCollection.cs similarity index 67% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseCollection.cs index 4765e45dc3d9..4cc44cb4d68f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiReleases method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiReleases method from an instance of . /// - public partial class ApiReleaseCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiReleaseCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiReleaseClientDiagnostics; - private readonly ApiReleaseRestOperations _apiReleaseRestClient; + private readonly ClientDiagnostics _serviceApiReleaseApiReleaseClientDiagnostics; + private readonly ApiReleaseRestOperations _serviceApiReleaseApiReleaseRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiReleaseCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiReleaseCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiReleaseCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiReleaseCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiReleaseResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiReleaseResource.ResourceType, out string apiReleaseApiVersion); - _apiReleaseRestClient = new ApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiReleaseApiVersion); + _serviceApiReleaseApiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiReleaseResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiReleaseResource.ResourceType, out string serviceApiReleaseApiReleaseApiVersion); + _serviceApiReleaseApiReleaseRestClient = new ApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiReleaseApiReleaseApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -49,8 +49,8 @@ internal ApiReleaseCollection(ArmClient client, ResourceIdentifier id) : base(cl internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// @@ -73,17 +73,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.CreateOrUpdate"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiReleaseRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiReleaseResource(Client, response), response.GetRawResponse())); + var response = await _serviceApiReleaseApiReleaseRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiReleaseResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -115,17 +115,17 @@ public virtual async Task> CreateOrUpdateAsync( /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.CreateOrUpdate"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiReleaseRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiReleaseResource(Client, response), response.GetRawResponse())); + var response = _serviceApiReleaseApiReleaseRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiReleaseResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -154,18 +154,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnt /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string releaseId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string releaseId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.Get"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.Get"); scope.Start(); try { - var response = await _apiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -191,18 +191,18 @@ public virtual async Task> GetAsync(string releaseI /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string releaseId, CancellationToken cancellationToken = default) + public virtual Response Get(string releaseId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.Get"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.Get"); scope.Start(); try { - var response = _apiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -228,12 +228,12 @@ public virtual Response Get(string releaseId, CancellationTo /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _apiReleaseClientDiagnostics, Pipeline, "ApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiReleaseApiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiReleaseApiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _serviceApiReleaseApiReleaseClientDiagnostics, Pipeline, "ServiceApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,12 +253,12 @@ public virtual AsyncPageable GetAllAsync(string filter = nul /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _apiReleaseClientDiagnostics, Pipeline, "ApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiReleaseApiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiReleaseApiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _serviceApiReleaseApiReleaseClientDiagnostics, Pipeline, "ServiceApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -282,11 +282,11 @@ public virtual async Task> ExistsAsync(string releaseId, Cancella { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.Exists"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.Exists"); scope.Start(); try { - var response = await _apiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -317,11 +317,11 @@ public virtual Response Exists(string releaseId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.Exists"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.Exists"); scope.Start(); try { - var response = _apiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -348,18 +348,18 @@ public virtual Response Exists(string releaseId, CancellationToken cancell /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string releaseId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string releaseId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.GetIfExists"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.GetIfExists"); scope.Start(); try { - var response = await _apiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -385,18 +385,18 @@ public virtual async Task> GetIfExistsAsync /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string releaseId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string releaseId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.GetIfExists"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.GetIfExists"); scope.Start(); try { - var response = _apiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -405,7 +405,7 @@ public virtual NullableResponse GetIfExists(string releaseId } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -415,7 +415,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseResource.cs similarity index 72% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseResource.cs index 8b4b27a94d2e..764d6b6a2656 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseResource.cs @@ -17,14 +17,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiRelease along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiReleaseResource method. - /// Otherwise you can get one from its parent resource using the GetApiRelease method. + /// A Class representing a ServiceApiRelease along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiReleaseResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiRelease method. /// - public partial class ApiReleaseResource : ArmResource + public partial class ServiceApiReleaseResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -36,35 +36,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiReleaseClientDiagnostics; - private readonly ApiReleaseRestOperations _apiReleaseRestClient; + private readonly ClientDiagnostics _serviceApiReleaseApiReleaseClientDiagnostics; + private readonly ApiReleaseRestOperations _serviceApiReleaseApiReleaseRestClient; private readonly ApiReleaseData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis/releases"; - /// Initializes a new instance of the class for mocking. - protected ApiReleaseResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiReleaseResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiReleaseResource(ArmClient client, ApiReleaseData data) : this(client, data.Id) + internal ServiceApiReleaseResource(ArmClient client, ApiReleaseData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiReleaseResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiReleaseResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiReleaseApiVersion); - _apiReleaseRestClient = new ApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiReleaseApiVersion); + _serviceApiReleaseApiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiReleaseApiReleaseApiVersion); + _serviceApiReleaseApiReleaseRestClient = new ApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiReleaseApiReleaseApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -105,16 +105,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Get"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Get"); scope.Start(); try { - var response = await _apiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -137,16 +137,16 @@ public virtual async Task> GetAsync(CancellationTok /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Get"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Get"); scope.Start(); try { - var response = _apiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -173,11 +173,11 @@ public virtual Response Get(CancellationToken cancellationTo /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Delete"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Delete"); scope.Start(); try { - var response = await _apiReleaseRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -208,11 +208,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Delete"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Delete"); scope.Start(); try { - var response = _apiReleaseRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -242,16 +242,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// API Release Update parameters. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Update"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Update"); scope.Start(); try { - var response = await _apiReleaseRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceApiReleaseApiReleaseRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -277,16 +277,16 @@ public virtual async Task> UpdateAsync(ETag ifMatch /// API Release Update parameters. /// The cancellation token to use. /// is null. - public virtual Response Update(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + public virtual Response Update(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Update"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Update"); scope.Start(); try { - var response = _apiReleaseRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceApiReleaseApiReleaseRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -311,11 +311,11 @@ public virtual Response Update(ETag ifMatch, ApiReleaseData /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.GetEntityTag"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.GetEntityTag"); scope.Start(); try { - var response = await _apiReleaseRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -341,11 +341,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.GetEntityTag"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.GetEntityTag"); scope.Start(); try { - var response = _apiReleaseRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyCollection.cs new file mode 100644 index 000000000000..ab7e364ab1e6 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyCollection.cs @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiResolverPolicies method from an instance of . + /// + public partial class ServiceApiResolverPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics; + private readonly GraphQLApiResolverPolicyRestOperations _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceApiResolverPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceApiResolverPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiResolverPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiResolverPolicyResource.ResourceType, out string serviceApiResolverPolicyGraphQLApiResolverPolicyApiVersion); + _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient = new GraphQLApiResolverPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiResolverPolicyGraphQLApiResolverPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResolverContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResolverContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiResolverPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiResolverPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_ListByResolver + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateListByResolverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateListByResolverNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiResolverPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics, Pipeline, "ServiceApiResolverPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_ListByResolver + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateListByResolverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateListByResolverNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiResolverPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics, Pipeline, "ServiceApiResolverPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyResource.cs new file mode 100644 index 000000000000..87de6eabfeda --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyResource.cs @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceApiResolverPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiResolverPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiResolverPolicy method. + /// + public partial class ServiceApiResolverPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The resolverId. + /// The policyId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics; + private readonly GraphQLApiResolverPolicyRestOperations _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient; + private readonly PolicyContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis/resolvers/policies"; + + /// Initializes a new instance of the class for mocking. + protected ServiceApiResolverPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceApiResolverPolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceApiResolverPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiResolverPolicyGraphQLApiResolverPolicyApiVersion); + _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient = new GraphQLApiResolverPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiResolverPolicyGraphQLApiResolverPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the GraphQL Api Resolver. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the GraphQL Api Resolver. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiResolverPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiResolverPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResource.cs similarity index 78% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResource.cs index d8d8a2930258..8cfe9b7e926e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResource.cs @@ -19,14 +19,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an Api along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiResource method. - /// Otherwise you can get one from its parent resource using the GetApi method. + /// A Class representing a ServiceApi along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApi method. /// - public partial class ApiResource : ArmResource + public partial class ServiceApiResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -37,8 +37,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiClientDiagnostics; - private readonly ApiRestOperations _apiRestClient; + private readonly ClientDiagnostics _serviceApiApiClientDiagnostics; + private readonly ApiRestOperations _serviceApiApiRestClient; private readonly ClientDiagnostics _apiRevisionClientDiagnostics; private readonly ApiRevisionRestOperations _apiRevisionRestClient; private readonly ClientDiagnostics _apiProductClientDiagnostics; @@ -50,28 +50,28 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis"; - /// Initializes a new instance of the class for mocking. - protected ApiResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiResource(ArmClient client, ApiData data) : this(client, data.Id) + internal ServiceApiResource(ArmClient client, ApiData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiApiVersion); - _apiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiApiVersion); + _serviceApiApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiApiApiVersion); + _serviceApiApiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiApiApiVersion); _apiRevisionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _apiRevisionRestClient = new ApiRevisionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _apiProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -104,11 +104,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of ApiReleaseResources in the Api. - /// An object representing collection of ApiReleaseResources and their operations over a ApiReleaseResource. - public virtual ApiReleaseCollection GetApiReleases() + /// Gets a collection of ServiceApiReleaseResources in the ServiceApi. + /// An object representing collection of ServiceApiReleaseResources and their operations over a ServiceApiReleaseResource. + public virtual ServiceApiReleaseCollection GetServiceApiReleases() { - return GetCachedClient(client => new ApiReleaseCollection(client, Id)); + return GetCachedClient(client => new ServiceApiReleaseCollection(client, Id)); } /// @@ -129,9 +129,9 @@ public virtual ApiReleaseCollection GetApiReleases() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetApiReleaseAsync(string releaseId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiReleaseAsync(string releaseId, CancellationToken cancellationToken = default) { - return await GetApiReleases().GetAsync(releaseId, cancellationToken).ConfigureAwait(false); + return await GetServiceApiReleases().GetAsync(releaseId, cancellationToken).ConfigureAwait(false); } /// @@ -152,16 +152,16 @@ public virtual async Task> GetApiReleaseAsync(strin /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetApiRelease(string releaseId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApiRelease(string releaseId, CancellationToken cancellationToken = default) { - return GetApiReleases().Get(releaseId, cancellationToken); + return GetServiceApiReleases().Get(releaseId, cancellationToken); } - /// Gets a collection of ApiOperationResources in the Api. - /// An object representing collection of ApiOperationResources and their operations over a ApiOperationResource. - public virtual ApiOperationCollection GetApiOperations() + /// Gets a collection of ServiceApiOperationResources in the ServiceApi. + /// An object representing collection of ServiceApiOperationResources and their operations over a ServiceApiOperationResource. + public virtual ServiceApiOperationCollection GetServiceApiOperations() { - return GetCachedClient(client => new ApiOperationCollection(client, Id)); + return GetCachedClient(client => new ServiceApiOperationCollection(client, Id)); } /// @@ -182,9 +182,9 @@ public virtual ApiOperationCollection GetApiOperations() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetApiOperationAsync(string operationId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiOperationAsync(string operationId, CancellationToken cancellationToken = default) { - return await GetApiOperations().GetAsync(operationId, cancellationToken).ConfigureAwait(false); + return await GetServiceApiOperations().GetAsync(operationId, cancellationToken).ConfigureAwait(false); } /// @@ -205,12 +205,12 @@ public virtual async Task> GetApiOperationAsync(s /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetApiOperation(string operationId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApiOperation(string operationId, CancellationToken cancellationToken = default) { - return GetApiOperations().Get(operationId, cancellationToken); + return GetServiceApiOperations().Get(operationId, cancellationToken); } - /// Gets a collection of ApiPolicyResources in the Api. + /// Gets a collection of ApiPolicyResources in the ServiceApi. /// An object representing collection of ApiPolicyResources and their operations over a ApiPolicyResource. public virtual ApiPolicyCollection GetApiPolicies() { @@ -261,7 +261,7 @@ public virtual Response GetApiPolicy(PolicyName policyId, Pol return GetApiPolicies().Get(policyId, format, cancellationToken); } - /// Gets a collection of ApiTagResources in the Api. + /// Gets a collection of ApiTagResources in the ServiceApi. /// An object representing collection of ApiTagResources and their operations over a ApiTagResource. public virtual ApiTagCollection GetApiTags() { @@ -314,11 +314,64 @@ public virtual Response GetApiTag(string tagId, CancellationToke return GetApiTags().Get(tagId, cancellationToken); } - /// Gets a collection of ApiSchemaResources in the Api. - /// An object representing collection of ApiSchemaResources and their operations over a ApiSchemaResource. - public virtual ApiSchemaCollection GetApiSchemas() + /// Gets a collection of ResolverContractResources in the ServiceApi. + /// An object representing collection of ResolverContractResources and their operations over a ResolverContractResource. + public virtual ResolverContractCollection GetResolverContracts() { - return GetCachedClient(client => new ApiSchemaCollection(client, Id)); + return GetCachedClient(client => new ResolverContractCollection(client, Id)); + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResolverContractAsync(string resolverId, CancellationToken cancellationToken = default) + { + return await GetResolverContracts().GetAsync(resolverId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResolverContract(string resolverId, CancellationToken cancellationToken = default) + { + return GetResolverContracts().Get(resolverId, cancellationToken); + } + + /// Gets a collection of ServiceApiSchemaResources in the ServiceApi. + /// An object representing collection of ServiceApiSchemaResources and their operations over a ServiceApiSchemaResource. + public virtual ServiceApiSchemaCollection GetServiceApiSchemas() + { + return GetCachedClient(client => new ServiceApiSchemaCollection(client, Id)); } /// @@ -339,9 +392,9 @@ public virtual ApiSchemaCollection GetApiSchemas() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetApiSchemaAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiSchemaAsync(string schemaId, CancellationToken cancellationToken = default) { - return await GetApiSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); + return await GetServiceApiSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); } /// @@ -362,12 +415,12 @@ public virtual async Task> GetApiSchemaAsync(string /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetApiSchema(string schemaId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApiSchema(string schemaId, CancellationToken cancellationToken = default) { - return GetApiSchemas().Get(schemaId, cancellationToken); + return GetServiceApiSchemas().Get(schemaId, cancellationToken); } - /// Gets a collection of ApiDiagnosticResources in the Api. + /// Gets a collection of ApiDiagnosticResources in the ServiceApi. /// An object representing collection of ApiDiagnosticResources and their operations over a ApiDiagnosticResource. public virtual ApiDiagnosticCollection GetApiDiagnostics() { @@ -420,7 +473,7 @@ public virtual Response GetApiDiagnostic(string diagnosti return GetApiDiagnostics().Get(diagnosticId, cancellationToken); } - /// Gets a collection of ApiIssueResources in the Api. + /// Gets a collection of ApiIssueResources in the ServiceApi. /// An object representing collection of ApiIssueResources and their operations over a ApiIssueResource. public virtual ApiIssueCollection GetApiIssues() { @@ -475,7 +528,7 @@ public virtual Response GetApiIssue(string issueId, bool? expa return GetApiIssues().Get(issueId, expandCommentsAttachments, cancellationToken); } - /// Gets a collection of ApiTagDescriptionResources in the Api. + /// Gets a collection of ApiTagDescriptionResources in the ServiceApi. /// An object representing collection of ApiTagDescriptionResources and their operations over a ApiTagDescriptionResource. public virtual ApiTagDescriptionCollection GetApiTagDescriptions() { @@ -528,6 +581,13 @@ public virtual Response GetApiTagDescription(string t return GetApiTagDescriptions().Get(tagDescriptionId, cancellationToken); } + /// Gets an object representing a ServiceApiWikiResource along with the instance operations that can be performed on it in the ServiceApi. + /// Returns a object. + public virtual ServiceApiWikiResource GetServiceApiWiki() + { + return new ServiceApiWikiResource(Client, Id.AppendChildResource("wikis", "default")); + } + /// /// Gets the details of the API specified by its identifier. /// @@ -542,16 +602,16 @@ public virtual Response GetApiTagDescription(string t /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Get"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Get"); scope.Start(); try { - var response = await _apiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -574,16 +634,16 @@ public virtual async Task> GetAsync(CancellationToken canc /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Get"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Get"); scope.Start(); try { - var response = _apiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -611,12 +671,12 @@ public virtual Response Get(CancellationToken cancellationToken = d /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Delete"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Delete"); scope.Start(); try { - var response = await _apiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(response); + var response = await _serviceApiApiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(_serviceApiApiClientDiagnostics, Pipeline, _serviceApiApiRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -647,12 +707,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Delete"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Delete"); scope.Start(); try { - var response = _apiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken); - var operation = new ApiManagementArmOperation(response); + var response = _serviceApiApiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken); + var operation = new ApiManagementArmOperation(_serviceApiApiClientDiagnostics, Pipeline, _serviceApiApiRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -678,19 +738,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? dele /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// API Update Contract parameters. + /// API Update Contract parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Update"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Update"); scope.Start(); try { - var response = await _apiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceApiApiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, apiUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -713,19 +773,19 @@ public virtual async Task> UpdateAsync(ETag ifMatch, ApiPa /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// API Update Contract parameters. + /// API Update Contract parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Update"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Update"); scope.Start(); try { - var response = _apiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceApiApiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, apiUpdateContract, cancellationToken); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -756,7 +816,7 @@ public virtual AsyncPageable GetApiRevisionsByServiceAsync( { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _apiRevisionClientDiagnostics, Pipeline, "ApiResource.GetApiRevisionsByService", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _apiRevisionClientDiagnostics, Pipeline, "ServiceApiResource.GetApiRevisionsByService", "value", "nextLink", cancellationToken); } /// @@ -781,7 +841,7 @@ public virtual Pageable GetApiRevisionsByService(string fil { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _apiRevisionClientDiagnostics, Pipeline, "ApiResource.GetApiRevisionsByService", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _apiRevisionClientDiagnostics, Pipeline, "ServiceApiResource.GetApiRevisionsByService", "value", "nextLink", cancellationToken); } /// @@ -801,12 +861,12 @@ public virtual Pageable GetApiRevisionsByService(string fil /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApiProductsAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApiProductsAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiProductRestClient.CreateListByApisRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiProductRestClient.CreateListByApisNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiProductClientDiagnostics, Pipeline, "ApiResource.GetApiProducts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementProductData.DeserializeApiManagementProductData, _apiProductClientDiagnostics, Pipeline, "ServiceApiResource.GetApiProducts", "value", "nextLink", cancellationToken); } /// @@ -826,12 +886,12 @@ public virtual AsyncPageable GetApiProductsAsync(s /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApiProducts(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApiProducts(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiProductRestClient.CreateListByApisRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiProductRestClient.CreateListByApisNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiProductClientDiagnostics, Pipeline, "ApiResource.GetApiProducts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementProductData.DeserializeApiManagementProductData, _apiProductClientDiagnostics, Pipeline, "ServiceApiResource.GetApiProducts", "value", "nextLink", cancellationToken); } /// @@ -857,7 +917,7 @@ public virtual AsyncPageable GetOperationsByTagsAsyn { HttpMessage FirstPageRequest(int? pageSizeHint) => _operationRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, includeNotTaggedOperations); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _operationRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, includeNotTaggedOperations); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _operationClientDiagnostics, Pipeline, "ApiResource.GetOperationsByTags", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _operationClientDiagnostics, Pipeline, "ServiceApiResource.GetOperationsByTags", "value", "nextLink", cancellationToken); } /// @@ -883,7 +943,7 @@ public virtual Pageable GetOperationsByTags(string f { HttpMessage FirstPageRequest(int? pageSizeHint) => _operationRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, includeNotTaggedOperations); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _operationRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, includeNotTaggedOperations); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _operationClientDiagnostics, Pipeline, "ApiResource.GetOperationsByTags", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _operationClientDiagnostics, Pipeline, "ServiceApiResource.GetOperationsByTags", "value", "nextLink", cancellationToken); } /// @@ -902,11 +962,11 @@ public virtual Pageable GetOperationsByTags(string f /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.GetEntityTag"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.GetEntityTag"); scope.Start(); try { - var response = await _apiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -932,11 +992,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.GetEntityTag"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.GetEntityTag"); scope.Start(); try { - var response = _apiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiApiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaCollection.cs similarity index 66% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaCollection.cs index df4e00a1237f..eef456194873 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiSchemas method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiSchemas method from an instance of . /// - public partial class ApiSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiSchemaClientDiagnostics; - private readonly ApiSchemaRestOperations _apiSchemaRestClient; + private readonly ClientDiagnostics _serviceApiSchemaApiSchemaClientDiagnostics; + private readonly ApiSchemaRestOperations _serviceApiSchemaApiSchemaRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiSchemaCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiSchemaCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiSchemaResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiSchemaResource.ResourceType, out string apiSchemaApiVersion); - _apiSchemaRestClient = new ApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiSchemaApiVersion); + _serviceApiSchemaApiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiSchemaResource.ResourceType, out string serviceApiSchemaApiSchemaApiVersion); + _serviceApiSchemaApiSchemaRestClient = new ApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiSchemaApiSchemaApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -49,8 +49,8 @@ internal ApiSchemaCollection(ArmClient client, ResourceIdentifier id) : base(cli internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// @@ -73,17 +73,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.CreateOrUpdate"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiSchemaOperationSource(Client), _apiSchemaClientDiagnostics, Pipeline, _apiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceApiSchemaApiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceApiSchemaOperationSource(Client), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, _serviceApiSchemaApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -115,17 +115,17 @@ public virtual async Task> CreateOrUpdateAsync(W /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.CreateOrUpdate"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiSchemaOperationSource(Client), _apiSchemaClientDiagnostics, Pipeline, _apiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceApiSchemaApiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceApiSchemaOperationSource(Client), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, _serviceApiSchemaApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -154,18 +154,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnti /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.Get"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.Get"); scope.Start(); try { - var response = await _apiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -191,18 +191,18 @@ public virtual async Task> GetAsync(string schemaId, /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) + public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.Get"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.Get"); scope.Start(); try { - var response = _apiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -228,12 +228,12 @@ public virtual Response Get(string schemaId, CancellationToke /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _apiSchemaClientDiagnostics, Pipeline, "ApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiSchemaApiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiSchemaApiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, "ServiceApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,12 +253,12 @@ public virtual AsyncPageable GetAllAsync(string filter = null /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _apiSchemaClientDiagnostics, Pipeline, "ApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiSchemaApiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiSchemaApiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, "ServiceApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -282,11 +282,11 @@ public virtual async Task> ExistsAsync(string schemaId, Cancellat { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.Exists"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.Exists"); scope.Start(); try { - var response = await _apiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -317,11 +317,11 @@ public virtual Response Exists(string schemaId, CancellationToken cancella { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.Exists"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.Exists"); scope.Start(); try { - var response = _apiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -348,18 +348,18 @@ public virtual Response Exists(string schemaId, CancellationToken cancella /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.GetIfExists"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.GetIfExists"); scope.Start(); try { - var response = await _apiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -385,18 +385,18 @@ public virtual async Task> GetIfExistsAsync( /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string schemaId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.GetIfExists"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.GetIfExists"); scope.Start(); try { - var response = _apiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -405,7 +405,7 @@ public virtual NullableResponse GetIfExists(string schemaId, } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -415,7 +415,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaResource.cs similarity index 72% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaResource.cs index f63bd8db82ec..d60b4116e55f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaResource.cs @@ -17,14 +17,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiSchema along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiSchemaResource method. - /// Otherwise you can get one from its parent resource using the GetApiSchema method. + /// A Class representing a ServiceApiSchema along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiSchema method. /// - public partial class ApiSchemaResource : ArmResource + public partial class ServiceApiSchemaResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -36,35 +36,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiSchemaClientDiagnostics; - private readonly ApiSchemaRestOperations _apiSchemaRestClient; + private readonly ClientDiagnostics _serviceApiSchemaApiSchemaClientDiagnostics; + private readonly ApiSchemaRestOperations _serviceApiSchemaApiSchemaRestClient; private readonly ApiSchemaData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis/schemas"; - /// Initializes a new instance of the class for mocking. - protected ApiSchemaResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiSchemaResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiSchemaResource(ArmClient client, ApiSchemaData data) : this(client, data.Id) + internal ServiceApiSchemaResource(ArmClient client, ApiSchemaData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiSchemaApiVersion); - _apiSchemaRestClient = new ApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiSchemaApiVersion); + _serviceApiSchemaApiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiSchemaApiSchemaApiVersion); + _serviceApiSchemaApiSchemaRestClient = new ApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiSchemaApiSchemaApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -105,16 +105,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Get"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Get"); scope.Start(); try { - var response = await _apiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -137,16 +137,16 @@ public virtual async Task> GetAsync(CancellationToke /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Get"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Get"); scope.Start(); try { - var response = _apiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -174,11 +174,11 @@ public virtual Response Get(CancellationToken cancellationTok /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Delete"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Delete"); scope.Start(); try { - var response = await _apiSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -210,11 +210,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Delete"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Delete"); scope.Start(); try { - var response = _apiSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -245,16 +245,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? forc /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Update"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Update"); scope.Start(); try { - var response = await _apiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiSchemaOperationSource(Client), _apiSchemaClientDiagnostics, Pipeline, _apiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceApiSchemaApiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceApiSchemaOperationSource(Client), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, _serviceApiSchemaApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -284,16 +284,16 @@ public virtual async Task> UpdateAsync(WaitUntil /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Update"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Update"); scope.Start(); try { - var response = _apiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiSchemaOperationSource(Client), _apiSchemaClientDiagnostics, Pipeline, _apiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceApiSchemaApiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceApiSchemaOperationSource(Client), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, _serviceApiSchemaApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -321,11 +321,11 @@ public virtual ArmOperation Update(WaitUntil waitUntil, ApiSc /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.GetEntityTag"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.GetEntityTag"); scope.Start(); try { - var response = await _apiSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -351,11 +351,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.GetEntityTag"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.GetEntityTag"); scope.Start(); try { - var response = _apiSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetCollection.cs similarity index 67% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetCollection.cs index 25ef377d8042..e2bb22dc017d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiVersionSets method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiVersionSets method from an instance of . /// - public partial class ApiVersionSetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiVersionSetCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiVersionSetClientDiagnostics; - private readonly ApiVersionSetRestOperations _apiVersionSetRestClient; + private readonly ClientDiagnostics _serviceApiVersionSetApiVersionSetClientDiagnostics; + private readonly ApiVersionSetRestOperations _serviceApiVersionSetApiVersionSetRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiVersionSetCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiVersionSetCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiVersionSetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiVersionSetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiVersionSetResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiVersionSetResource.ResourceType, out string apiVersionSetApiVersion); - _apiVersionSetRestClient = new ApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiVersionSetApiVersion); + _serviceApiVersionSetApiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiVersionSetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiVersionSetResource.ResourceType, out string serviceApiVersionSetApiVersionSetApiVersion); + _serviceApiVersionSetApiVersionSetRestClient = new ApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiVersionSetApiVersionSetApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -73,17 +73,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.CreateOrUpdate"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiVersionSetRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiVersionSetResource(Client, response), response.GetRawResponse())); + var response = await _serviceApiVersionSetApiVersionSetRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiVersionSetResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -115,17 +115,17 @@ public virtual async Task> CreateOrUpdateAsy /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.CreateOrUpdate"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiVersionSetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiVersionSetResource(Client, response), response.GetRawResponse())); + var response = _serviceApiVersionSetApiVersionSetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiVersionSetResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -154,18 +154,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wait /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string versionSetId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string versionSetId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.Get"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.Get"); scope.Start(); try { - var response = await _apiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -191,18 +191,18 @@ public virtual async Task> GetAsync(string versi /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string versionSetId, CancellationToken cancellationToken = default) + public virtual Response Get(string versionSetId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.Get"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.Get"); scope.Start(); try { - var response = _apiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -228,12 +228,12 @@ public virtual Response Get(string versionSetId, Cancella /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _apiVersionSetClientDiagnostics, Pipeline, "ApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiVersionSetApiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiVersionSetApiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _serviceApiVersionSetApiVersionSetClientDiagnostics, Pipeline, "ServiceApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,12 +253,12 @@ public virtual AsyncPageable GetAllAsync(string filter = /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _apiVersionSetClientDiagnostics, Pipeline, "ApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiVersionSetApiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiVersionSetApiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _serviceApiVersionSetApiVersionSetClientDiagnostics, Pipeline, "ServiceApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -282,11 +282,11 @@ public virtual async Task> ExistsAsync(string versionSetId, Cance { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.Exists"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.Exists"); scope.Start(); try { - var response = await _apiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -317,11 +317,11 @@ public virtual Response Exists(string versionSetId, CancellationToken canc { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.Exists"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.Exists"); scope.Start(); try { - var response = _apiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -348,18 +348,18 @@ public virtual Response Exists(string versionSetId, CancellationToken canc /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string versionSetId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string versionSetId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.GetIfExists"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.GetIfExists"); scope.Start(); try { - var response = await _apiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -385,18 +385,18 @@ public virtual async Task> GetIfExistsAs /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string versionSetId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string versionSetId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.GetIfExists"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.GetIfExists"); scope.Start(); try { - var response = _apiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -405,7 +405,7 @@ public virtual NullableResponse GetIfExists(string versio } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -415,7 +415,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetResource.cs similarity index 70% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetResource.cs index c57cad614b95..9811f5759ef5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetResource.cs @@ -18,14 +18,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiVersionSet along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiVersionSetResource method. - /// Otherwise you can get one from its parent resource using the GetApiVersionSet method. + /// A Class representing a ServiceApiVersionSet along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiVersionSetResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiVersionSet method. /// - public partial class ApiVersionSetResource : ArmResource + public partial class ServiceApiVersionSetResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -36,35 +36,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiVersionSetClientDiagnostics; - private readonly ApiVersionSetRestOperations _apiVersionSetRestClient; + private readonly ClientDiagnostics _serviceApiVersionSetApiVersionSetClientDiagnostics; + private readonly ApiVersionSetRestOperations _serviceApiVersionSetApiVersionSetRestClient; private readonly ApiVersionSetData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apiVersionSets"; - /// Initializes a new instance of the class for mocking. - protected ApiVersionSetResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiVersionSetResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiVersionSetResource(ArmClient client, ApiVersionSetData data) : this(client, data.Id) + internal ServiceApiVersionSetResource(ArmClient client, ApiVersionSetData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiVersionSetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiVersionSetResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiVersionSetApiVersion); - _apiVersionSetRestClient = new ApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiVersionSetApiVersion); + _serviceApiVersionSetApiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiVersionSetApiVersionSetApiVersion); + _serviceApiVersionSetApiVersionSetRestClient = new ApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiVersionSetApiVersionSetApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -105,16 +105,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Get"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Get"); scope.Start(); try { - var response = await _apiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -137,16 +137,16 @@ public virtual async Task> GetAsync(Cancellation /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Get"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Get"); scope.Start(); try { - var response = _apiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -173,11 +173,11 @@ public virtual Response Get(CancellationToken cancellatio /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Delete"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Delete"); scope.Start(); try { - var response = await _apiVersionSetRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -208,11 +208,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Delete"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Delete"); scope.Start(); try { - var response = _apiVersionSetRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -239,19 +239,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiVersionSetPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Update"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Update"); scope.Start(); try { - var response = await _apiVersionSetRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceApiVersionSetApiVersionSetRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, apiVersionSetUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -274,19 +274,19 @@ public virtual async Task> UpdateAsync(ETag ifMa /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiVersionSetPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Update"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Update"); scope.Start(); try { - var response = _apiVersionSetRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceApiVersionSetApiVersionSetRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, apiVersionSetUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -311,11 +311,11 @@ public virtual Response Update(ETag ifMatch, ApiVersionSe /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.GetEntityTag"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.GetEntityTag"); scope.Start(); try { - var response = await _apiVersionSetRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -341,11 +341,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.GetEntityTag"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.GetEntityTag"); scope.Start(); try { - var response = _apiVersionSetRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiWikiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiWikiResource.cs new file mode 100644 index 000000000000..0602ed5c4792 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiWikiResource.cs @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceApiWiki along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiWikiResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiWiki method. + /// + public partial class ServiceApiWikiResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceApiWikiApiWikiClientDiagnostics; + private readonly ApiWikiRestOperations _serviceApiWikiApiWikiRestClient; + private readonly WikiContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis/wikis"; + + /// Initializes a new instance of the class for mocking. + protected ServiceApiWikiResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceApiWikiResource(ArmClient client, WikiContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceApiWikiResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceApiWikiApiWikiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiWikiApiWikiApiVersion); + _serviceApiWikiApiWikiRestClient = new ApiWikiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiWikiApiWikiApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WikiContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Get"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Get"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Wiki from an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Delete"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Wiki from an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Delete"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Wiki Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Update"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, wikiUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Wiki Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Update"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, wikiUpdateContract, cancellationToken); + return Response.FromValue(new ServiceApiWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Wiki for an API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiWikiResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Wiki for an API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiWikiResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupCollection.cs similarity index 67% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupCollection.cs index 18b28afc0f59..0b47f475300e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupCollection.cs @@ -21,28 +21,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementGroups method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceGroups method from an instance of . /// - public partial class ApiManagementGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementGroupGroupClientDiagnostics; - private readonly GroupRestOperations _apiManagementGroupGroupRestClient; + private readonly ClientDiagnostics _serviceGroupGroupClientDiagnostics; + private readonly GroupRestOperations _serviceGroupGroupRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementGroupCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceGroupCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementGroupGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementGroupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementGroupResource.ResourceType, out string apiManagementGroupGroupApiVersion); - _apiManagementGroupGroupRestClient = new GroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementGroupGroupApiVersion); + _serviceGroupGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceGroupResource.ResourceType, out string serviceGroupGroupApiVersion); + _serviceGroupGroupRestClient = new GroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceGroupGroupApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -69,22 +69,22 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Group identifier. Must be unique in the current API Management service instance. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.CreateOrUpdate"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, content, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementGroupResource(Client, response), response.GetRawResponse())); + var response = await _serviceGroupGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, groupCreateParameters, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceGroupResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -111,22 +111,22 @@ public virtual async Task> CreateOrUpda /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Group identifier. Must be unique in the current API Management service instance. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.CreateOrUpdate"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, content, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementGroupResource(Client, response), response.GetRawResponse())); + var response = _serviceGroupGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, groupCreateParameters, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceGroupResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -155,18 +155,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string groupId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string groupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.Get"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.Get"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -192,18 +192,18 @@ public virtual async Task> GetAsync(string /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string groupId, CancellationToken cancellationToken = default) + public virtual Response Get(string groupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.Get"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.Get"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken); + var response = _serviceGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -229,12 +229,12 @@ public virtual Response Get(string groupId, Cancella /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _apiManagementGroupGroupClientDiagnostics, Pipeline, "ApiManagementGroupCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _serviceGroupGroupClientDiagnostics, Pipeline, "ServiceGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,12 +254,12 @@ public virtual AsyncPageable GetAllAsync(string filt /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _apiManagementGroupGroupClientDiagnostics, Pipeline, "ApiManagementGroupCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _serviceGroupGroupClientDiagnostics, Pipeline, "ServiceGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -283,11 +283,11 @@ public virtual async Task> ExistsAsync(string groupId, Cancellati { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.Exists"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.Exists"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -318,11 +318,11 @@ public virtual Response Exists(string groupId, CancellationToken cancellat { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.Exists"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.Exists"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); + var response = _serviceGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -349,18 +349,18 @@ public virtual Response Exists(string groupId, CancellationToken cancellat /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string groupId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string groupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.GetIfExists"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.GetIfExists"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -386,18 +386,18 @@ public virtual async Task> GetIfExi /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string groupId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string groupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.GetIfExists"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.GetIfExists"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); + var response = _serviceGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -406,7 +406,7 @@ public virtual NullableResponse GetIfExists(string g } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -416,7 +416,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupResource.cs similarity index 83% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupResource.cs index dac6f1b56e66..45cb6ec8c4ee 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupResource.cs @@ -19,14 +19,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementGroup along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementGroupResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementGroup method. + /// A Class representing a ServiceGroup along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceGroupResource method. + /// Otherwise you can get one from its parent resource using the GetServiceGroup method. /// - public partial class ApiManagementGroupResource : ArmResource + public partial class ServiceGroupResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -37,8 +37,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementGroupGroupClientDiagnostics; - private readonly GroupRestOperations _apiManagementGroupGroupRestClient; + private readonly ClientDiagnostics _serviceGroupGroupClientDiagnostics; + private readonly GroupRestOperations _serviceGroupGroupRestClient; private readonly ClientDiagnostics _groupUserClientDiagnostics; private readonly GroupUserRestOperations _groupUserRestClient; private readonly ApiManagementGroupData _data; @@ -46,28 +46,28 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/groups"; - /// Initializes a new instance of the class for mocking. - protected ApiManagementGroupResource() + /// Initializes a new instance of the class for mocking. + protected ServiceGroupResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementGroupResource(ArmClient client, ApiManagementGroupData data) : this(client, data.Id) + internal ServiceGroupResource(ArmClient client, ApiManagementGroupData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementGroupGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementGroupGroupApiVersion); - _apiManagementGroupGroupRestClient = new GroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementGroupGroupApiVersion); + _serviceGroupGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceGroupGroupApiVersion); + _serviceGroupGroupRestClient = new GroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceGroupGroupApiVersion); _groupUserClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _groupUserRestClient = new GroupUserRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG @@ -110,16 +110,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Get"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Get"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -142,16 +142,16 @@ public virtual async Task> GetAsync(Cancell /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Get"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Get"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -178,11 +178,11 @@ public virtual Response Get(CancellationToken cancel /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Delete"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Delete"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -213,11 +213,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Delete"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Delete"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceGroupGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -244,19 +244,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiManagementGroupPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Update"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Update"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceGroupGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, groupUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -279,19 +279,19 @@ public virtual async Task> UpdateAsync(ETag /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiManagementGroupPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Update"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Update"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceGroupGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, groupUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -322,7 +322,7 @@ public virtual AsyncPageable GetGroupUsersAsync(stri { HttpMessage FirstPageRequest(int? pageSizeHint) => _groupUserRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupUserRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementGroupUserData.DeserializeApiManagementGroupUserData, _groupUserClientDiagnostics, Pipeline, "ApiManagementGroupResource.GetGroupUsers", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementGroupUserData.DeserializeApiManagementGroupUserData, _groupUserClientDiagnostics, Pipeline, "ServiceGroupResource.GetGroupUsers", "value", "nextLink", cancellationToken); } /// @@ -347,7 +347,7 @@ public virtual Pageable GetGroupUsers(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _groupUserRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupUserRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementGroupUserData.DeserializeApiManagementGroupUserData, _groupUserClientDiagnostics, Pipeline, "ApiManagementGroupResource.GetGroupUsers", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementGroupUserData.DeserializeApiManagementGroupUserData, _groupUserClientDiagnostics, Pipeline, "ServiceGroupResource.GetGroupUsers", "value", "nextLink", cancellationToken); } /// @@ -371,7 +371,7 @@ public virtual async Task> CheckGroupUserEntityExistsAsync(string { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.CheckGroupUserEntityExists"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.CheckGroupUserEntityExists"); scope.Start(); try { @@ -406,7 +406,7 @@ public virtual Response CheckGroupUserEntityExists(string userId, Cancella { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.CheckGroupUserEntityExists"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.CheckGroupUserEntityExists"); scope.Start(); try { @@ -441,7 +441,7 @@ public virtual async Task> CreateGroupUserA { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.CreateGroupUser"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.CreateGroupUser"); scope.Start(); try { @@ -476,7 +476,7 @@ public virtual Response CreateGroupUser(string userI { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.CreateGroupUser"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.CreateGroupUser"); scope.Start(); try { @@ -511,7 +511,7 @@ public virtual async Task DeleteGroupUserAsync(string userId, Cancella { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.DeleteGroupUser"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.DeleteGroupUser"); scope.Start(); try { @@ -546,7 +546,7 @@ public virtual Response DeleteGroupUser(string userId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.DeleteGroupUser"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.DeleteGroupUser"); scope.Start(); try { @@ -576,11 +576,11 @@ public virtual Response DeleteGroupUser(string userId, CancellationToken cancell /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.GetEntityTag"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.GetEntityTag"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -606,11 +606,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.GetEntityTag"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.GetEntityTag"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceGroupGroupRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueCollection.cs similarity index 63% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueCollection.cs index 163d008d0964..49ddf9c2b15a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueCollection.cs @@ -21,28 +21,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementNamedValues method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceNamedValues method from an instance of . /// - public partial class ApiManagementNamedValueCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceNamedValueCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementNamedValueNamedValueClientDiagnostics; - private readonly NamedValueRestOperations _apiManagementNamedValueNamedValueRestClient; + private readonly ClientDiagnostics _serviceNamedValueNamedValueClientDiagnostics; + private readonly NamedValueRestOperations _serviceNamedValueNamedValueRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementNamedValueCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceNamedValueCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementNamedValueCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceNamedValueCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementNamedValueNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementNamedValueResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementNamedValueResource.ResourceType, out string apiManagementNamedValueNamedValueApiVersion); - _apiManagementNamedValueNamedValueRestClient = new NamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementNamedValueNamedValueApiVersion); + _serviceNamedValueNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceNamedValueResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceNamedValueResource.ResourceType, out string serviceNamedValueNamedValueApiVersion); + _serviceNamedValueNamedValueRestClient = new NamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceNamedValueNamedValueApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -69,22 +69,22 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Identifier of the NamedValue. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.CreateOrUpdate"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, content, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, content, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceNamedValueNamedValueRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, namedValueCreateContract, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, namedValueCreateContract, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -111,22 +111,22 @@ public virtual async Task> CreateO /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Identifier of the NamedValue. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.CreateOrUpdate"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, content, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, content, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceNamedValueNamedValueRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, namedValueCreateContract, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, namedValueCreateContract, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -155,18 +155,18 @@ public virtual ArmOperation CreateOrUpdate(Wait /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string namedValueId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string namedValueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.Get"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.Get"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -192,18 +192,18 @@ public virtual async Task> GetAsync(st /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string namedValueId, CancellationToken cancellationToken = default) + public virtual Response Get(string namedValueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.Get"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.Get"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -230,12 +230,12 @@ public virtual Response Get(string namedValueId /// Number of records to skip. /// When set to true, the response contains only named value entities which failed refresh. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, "ApiManagementNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, "ServiceNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -256,12 +256,12 @@ public virtual AsyncPageable GetAllAsync(string /// Number of records to skip. /// When set to true, the response contains only named value entities which failed refresh. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, "ApiManagementNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, "ServiceNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -285,11 +285,11 @@ public virtual async Task> ExistsAsync(string namedValueId, Cance { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.Exists"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.Exists"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -320,11 +320,11 @@ public virtual Response Exists(string namedValueId, CancellationToken canc { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.Exists"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.Exists"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -351,18 +351,18 @@ public virtual Response Exists(string namedValueId, CancellationToken canc /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string namedValueId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string namedValueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.GetIfExists"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.GetIfExists"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -388,18 +388,18 @@ public virtual async Task> Get /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string namedValueId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string namedValueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.GetIfExists"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.GetIfExists"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -408,7 +408,7 @@ public virtual NullableResponse GetIfExists(str } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -418,7 +418,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueResource.cs similarity index 70% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueResource.cs index e3a430155ebb..4a1e1a66d827 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueResource.cs @@ -18,14 +18,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementNamedValue along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementNamedValueResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementNamedValue method. + /// A Class representing a ServiceNamedValue along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceNamedValueResource method. + /// Otherwise you can get one from its parent resource using the GetServiceNamedValue method. /// - public partial class ApiManagementNamedValueResource : ArmResource + public partial class ServiceNamedValueResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -36,35 +36,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementNamedValueNamedValueClientDiagnostics; - private readonly NamedValueRestOperations _apiManagementNamedValueNamedValueRestClient; + private readonly ClientDiagnostics _serviceNamedValueNamedValueClientDiagnostics; + private readonly NamedValueRestOperations _serviceNamedValueNamedValueRestClient; private readonly ApiManagementNamedValueData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/namedValues"; - /// Initializes a new instance of the class for mocking. - protected ApiManagementNamedValueResource() + /// Initializes a new instance of the class for mocking. + protected ServiceNamedValueResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementNamedValueResource(ArmClient client, ApiManagementNamedValueData data) : this(client, data.Id) + internal ServiceNamedValueResource(ArmClient client, ApiManagementNamedValueData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementNamedValueResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceNamedValueResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementNamedValueNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementNamedValueNamedValueApiVersion); - _apiManagementNamedValueNamedValueRestClient = new NamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementNamedValueNamedValueApiVersion); + _serviceNamedValueNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceNamedValueNamedValueApiVersion); + _serviceNamedValueNamedValueRestClient = new NamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceNamedValueNamedValueApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -105,16 +105,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Get"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Get"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -137,16 +137,16 @@ public virtual async Task> GetAsync(Ca /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Get"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Get"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -173,11 +173,11 @@ public virtual Response Get(CancellationToken c /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Delete"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Delete"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -208,11 +208,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Delete"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Delete"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -240,19 +240,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag ifMatch, ApiManagementNamedValuePatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Update"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Update"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceNamedValueNamedValueRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -279,19 +279,19 @@ public virtual async Task> UpdateA /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ETag ifMatch, ApiManagementNamedValuePatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Update"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Update"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch).Request, response, OperationFinalStateVia.Location); + var response = _serviceNamedValueNamedValueRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -319,11 +319,11 @@ public virtual ArmOperation Update(WaitUntil wa /// The cancellation token to use. public virtual async Task> GetValueAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.GetValue"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.GetValue"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.ListValueAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.ListValueAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -349,11 +349,11 @@ public virtual async Task> GetValueAsync(Canc /// The cancellation token to use. public virtual Response GetValue(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.GetValue"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.GetValue"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.ListValue(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.ListValue(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -378,14 +378,14 @@ public virtual Response GetValue(CancellationToken can /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task> RefreshSecretAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task> RefreshSecretAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.RefreshSecret"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.RefreshSecret"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.RefreshSecretAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _serviceNamedValueNamedValueRestClient.RefreshSecretAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -412,14 +412,14 @@ public virtual async Task> Refresh /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual ArmOperation RefreshSecret(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation RefreshSecret(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.RefreshSecret"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.RefreshSecret"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.RefreshSecret(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _serviceNamedValueNamedValueRestClient.RefreshSecret(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -447,11 +447,11 @@ public virtual ArmOperation RefreshSecret(WaitU /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.GetEntityTag"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.GetEntityTag"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -477,11 +477,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.GetEntityTag"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.GetEntityTag"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationCollection.cs similarity index 60% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationCollection.cs index f11c36b0999b..e75ef00c646f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationCollection.cs @@ -21,28 +21,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementNotifications method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceNotifications method from an instance of . /// - public partial class ApiManagementNotificationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceNotificationCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementNotificationNotificationClientDiagnostics; - private readonly NotificationRestOperations _apiManagementNotificationNotificationRestClient; + private readonly ClientDiagnostics _serviceNotificationNotificationClientDiagnostics; + private readonly NotificationRestOperations _serviceNotificationNotificationRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementNotificationCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceNotificationCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementNotificationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceNotificationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementNotificationNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementNotificationResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementNotificationResource.ResourceType, out string apiManagementNotificationNotificationApiVersion); - _apiManagementNotificationNotificationRestClient = new NotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementNotificationNotificationApiVersion); + _serviceNotificationNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceNotificationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceNotificationResource.ResourceType, out string serviceNotificationNotificationApiVersion); + _serviceNotificationNotificationRestClient = new NotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceNotificationNotificationApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -71,14 +71,14 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Notification Name Identifier. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.CreateOrUpdate"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementNotificationResource(Client, response), response.GetRawResponse())); + var response = await _serviceNotificationNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceNotificationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -107,14 +107,14 @@ public virtual async Task> Creat /// Notification Name Identifier. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.CreateOrUpdate"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementNotificationResource(Client, response), response.GetRawResponse())); + var response = _serviceNotificationNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceNotificationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -141,16 +141,16 @@ public virtual ArmOperation CreateOrUpdate(Wa /// /// Notification Name Identifier. /// The cancellation token to use. - public virtual async Task> GetAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.Get"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.Get"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken).ConfigureAwait(false); + var response = await _serviceNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -174,16 +174,16 @@ public virtual async Task> GetAsync( /// /// Notification Name Identifier. /// The cancellation token to use. - public virtual Response Get(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual Response Get(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.Get"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.Get"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken); + var response = _serviceNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -208,12 +208,12 @@ public virtual Response Get(NotificationName /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _apiManagementNotificationNotificationClientDiagnostics, Pipeline, "ApiManagementNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _serviceNotificationNotificationClientDiagnostics, Pipeline, "ServiceNotificationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -232,12 +232,12 @@ public virtual AsyncPageable GetAllAsync(int? /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _apiManagementNotificationNotificationClientDiagnostics, Pipeline, "ApiManagementNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _serviceNotificationNotificationClientDiagnostics, Pipeline, "ServiceNotificationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -257,11 +257,11 @@ public virtual Pageable GetAll(int? top = nul /// The cancellation token to use. public virtual async Task> ExistsAsync(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.Exists"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.Exists"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -288,11 +288,11 @@ public virtual async Task> ExistsAsync(NotificationName notificat /// The cancellation token to use. public virtual Response Exists(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.Exists"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.Exists"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken); + var response = _serviceNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -317,16 +317,16 @@ public virtual Response Exists(NotificationName notificationName, Cancella /// /// Notification Name Identifier. /// The cancellation token to use. - public virtual async Task> GetIfExistsAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.GetIfExists"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.GetIfExists"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -350,16 +350,16 @@ public virtual async Task> G /// /// Notification Name Identifier. /// The cancellation token to use. - public virtual NullableResponse GetIfExists(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.GetIfExists"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.GetIfExists"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken); + var response = _serviceNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -368,7 +368,7 @@ public virtual NullableResponse GetIfExists(N } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -378,7 +378,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationResource.cs similarity index 86% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationResource.cs index 245212cde28b..59399e4e8338 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationResource.cs @@ -19,14 +19,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementNotification along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementNotificationResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementNotification method. + /// A Class representing a ServiceNotification along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceNotificationResource method. + /// Otherwise you can get one from its parent resource using the GetServiceNotification method. /// - public partial class ApiManagementNotificationResource : ArmResource + public partial class ServiceNotificationResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -37,8 +37,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementNotificationNotificationClientDiagnostics; - private readonly NotificationRestOperations _apiManagementNotificationNotificationRestClient; + private readonly ClientDiagnostics _serviceNotificationNotificationClientDiagnostics; + private readonly NotificationRestOperations _serviceNotificationNotificationRestClient; private readonly ClientDiagnostics _notificationRecipientUserClientDiagnostics; private readonly NotificationRecipientUserRestOperations _notificationRecipientUserRestClient; private readonly ClientDiagnostics _notificationRecipientEmailClientDiagnostics; @@ -48,28 +48,28 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/notifications"; - /// Initializes a new instance of the class for mocking. - protected ApiManagementNotificationResource() + /// Initializes a new instance of the class for mocking. + protected ServiceNotificationResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementNotificationResource(ArmClient client, ApiManagementNotificationData data) : this(client, data.Id) + internal ServiceNotificationResource(ArmClient client, ApiManagementNotificationData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementNotificationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceNotificationResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementNotificationNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementNotificationNotificationApiVersion); - _apiManagementNotificationNotificationRestClient = new NotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementNotificationNotificationApiVersion); + _serviceNotificationNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceNotificationNotificationApiVersion); + _serviceNotificationNotificationRestClient = new NotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceNotificationNotificationApiVersion); _notificationRecipientUserClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _notificationRecipientUserRestClient = new NotificationRecipientUserRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _notificationRecipientEmailClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -114,16 +114,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationResource.Get"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationResource.Get"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -146,16 +146,16 @@ public virtual async Task> GetAsync( /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationResource.Get"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationResource.Get"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -180,14 +180,14 @@ public virtual Response Get(CancellationToken /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationResource.Update"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationResource.Update"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementNotificationResource(Client, response), response.GetRawResponse())); + var response = await _serviceNotificationNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceNotificationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -215,14 +215,14 @@ public virtual async Task> Updat /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - public virtual ArmOperation Update(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationResource.Update"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationResource.Update"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementNotificationResource(Client, response), response.GetRawResponse())); + var response = _serviceNotificationNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceNotificationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -252,7 +252,7 @@ public virtual ArmOperation Update(WaitUntil public virtual AsyncPageable GetNotificationRecipientUsersAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationRecipientUserRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _notificationRecipientUserClientDiagnostics, Pipeline, "ApiManagementNotificationResource.GetNotificationRecipientUsers", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _notificationRecipientUserClientDiagnostics, Pipeline, "ServiceNotificationResource.GetNotificationRecipientUsers", "value", null, cancellationToken); } /// @@ -273,7 +273,7 @@ public virtual AsyncPageable GetNotificationRecipientUser public virtual Pageable GetNotificationRecipientUsers(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationRecipientUserRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _notificationRecipientUserClientDiagnostics, Pipeline, "ApiManagementNotificationResource.GetNotificationRecipientUsers", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _notificationRecipientUserClientDiagnostics, Pipeline, "ServiceNotificationResource.GetNotificationRecipientUsers", "value", null, cancellationToken); } /// @@ -297,7 +297,7 @@ public virtual async Task> CheckNotificationRecipientUserEntityEx { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.CheckNotificationRecipientUserEntityExists"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.CheckNotificationRecipientUserEntityExists"); scope.Start(); try { @@ -332,7 +332,7 @@ public virtual Response CheckNotificationRecipientUserEntityExists(string { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.CheckNotificationRecipientUserEntityExists"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.CheckNotificationRecipientUserEntityExists"); scope.Start(); try { @@ -367,7 +367,7 @@ public virtual async Task> CreateOrUpdateNotific { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.CreateOrUpdateNotificationRecipientUser"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.CreateOrUpdateNotificationRecipientUser"); scope.Start(); try { @@ -402,7 +402,7 @@ public virtual Response CreateOrUpdateNotificationRecipie { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.CreateOrUpdateNotificationRecipientUser"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.CreateOrUpdateNotificationRecipientUser"); scope.Start(); try { @@ -437,7 +437,7 @@ public virtual async Task DeleteNotificationRecipientUserAsync(string { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.DeleteNotificationRecipientUser"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.DeleteNotificationRecipientUser"); scope.Start(); try { @@ -472,7 +472,7 @@ public virtual Response DeleteNotificationRecipientUser(string userId, Cancellat { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.DeleteNotificationRecipientUser"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.DeleteNotificationRecipientUser"); scope.Start(); try { @@ -504,7 +504,7 @@ public virtual Response DeleteNotificationRecipientUser(string userId, Cancellat public virtual AsyncPageable GetNotificationRecipientEmailsAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationRecipientEmailRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _notificationRecipientEmailClientDiagnostics, Pipeline, "ApiManagementNotificationResource.GetNotificationRecipientEmails", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _notificationRecipientEmailClientDiagnostics, Pipeline, "ServiceNotificationResource.GetNotificationRecipientEmails", "value", null, cancellationToken); } /// @@ -525,7 +525,7 @@ public virtual AsyncPageable GetNotificationRecipientEma public virtual Pageable GetNotificationRecipientEmails(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationRecipientEmailRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _notificationRecipientEmailClientDiagnostics, Pipeline, "ApiManagementNotificationResource.GetNotificationRecipientEmails", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _notificationRecipientEmailClientDiagnostics, Pipeline, "ServiceNotificationResource.GetNotificationRecipientEmails", "value", null, cancellationToken); } /// @@ -549,7 +549,7 @@ public virtual async Task> CheckNotificationRecipientEmailEntityE { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.CheckNotificationRecipientEmailEntityExists"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.CheckNotificationRecipientEmailEntityExists"); scope.Start(); try { @@ -584,7 +584,7 @@ public virtual Response CheckNotificationRecipientEmailEntityExists(string { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.CheckNotificationRecipientEmailEntityExists"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.CheckNotificationRecipientEmailEntityExists"); scope.Start(); try { @@ -619,7 +619,7 @@ public virtual async Task> CreateOrUpdateNotifi { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.CreateOrUpdateNotificationRecipientEmail"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.CreateOrUpdateNotificationRecipientEmail"); scope.Start(); try { @@ -654,7 +654,7 @@ public virtual Response CreateOrUpdateNotificationRecipi { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.CreateOrUpdateNotificationRecipientEmail"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.CreateOrUpdateNotificationRecipientEmail"); scope.Start(); try { @@ -689,7 +689,7 @@ public virtual async Task DeleteNotificationRecipientEmailAsync(string { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.DeleteNotificationRecipientEmail"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.DeleteNotificationRecipientEmail"); scope.Start(); try { @@ -724,7 +724,7 @@ public virtual Response DeleteNotificationRecipientEmail(string email, Cancellat { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.DeleteNotificationRecipientEmail"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.DeleteNotificationRecipientEmail"); scope.Start(); try { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentCollection.cs new file mode 100644 index 000000000000..996fc1a8e834 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentCollection.cs @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServicePolicyFragments method from an instance of . + /// + public partial class ServicePolicyFragmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _servicePolicyFragmentPolicyFragmentClientDiagnostics; + private readonly PolicyFragmentRestOperations _servicePolicyFragmentPolicyFragmentRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServicePolicyFragmentCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServicePolicyFragmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _servicePolicyFragmentPolicyFragmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServicePolicyFragmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServicePolicyFragmentResource.ResourceType, out string servicePolicyFragmentPolicyFragmentApiVersion); + _servicePolicyFragmentPolicyFragmentRestClient = new PolicyFragmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, servicePolicyFragmentPolicyFragmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServicePolicyFragmentOperationSource(Client), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, _servicePolicyFragmentPolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServicePolicyFragmentOperationSource(Client), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, _servicePolicyFragmentPolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.Get"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.Get"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all policy fragments. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments + /// + /// + /// Operation Id + /// PolicyFragment_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, orderBy, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, orderBy, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServicePolicyFragmentResource(Client, PolicyFragmentContractData.DeserializePolicyFragmentContractData(e)), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, "ServicePolicyFragmentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all policy fragments. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments + /// + /// + /// Operation Id + /// PolicyFragment_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, orderBy, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, orderBy, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServicePolicyFragmentResource(Client, PolicyFragmentContractData.DeserializePolicyFragmentContractData(e)), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, "ServicePolicyFragmentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.Exists"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.Exists"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentResource.cs new file mode 100644 index 000000000000..5ca700677a17 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentResource.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServicePolicyFragment along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServicePolicyFragmentResource method. + /// Otherwise you can get one from its parent resource using the GetServicePolicyFragment method. + /// + public partial class ServicePolicyFragmentResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The id. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string id) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _servicePolicyFragmentPolicyFragmentClientDiagnostics; + private readonly PolicyFragmentRestOperations _servicePolicyFragmentPolicyFragmentRestClient; + private readonly PolicyFragmentContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/policyFragments"; + + /// Initializes a new instance of the class for mocking. + protected ServicePolicyFragmentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServicePolicyFragmentResource(ArmClient client, PolicyFragmentContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServicePolicyFragmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _servicePolicyFragmentPolicyFragmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string servicePolicyFragmentPolicyFragmentApiVersion); + _servicePolicyFragmentPolicyFragmentRestClient = new PolicyFragmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, servicePolicyFragmentPolicyFragmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyFragmentContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// Policy fragment content format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Get"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// Policy fragment content format. + /// The cancellation token to use. + public virtual Response Get(PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Get"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Delete"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Delete"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Update"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServicePolicyFragmentOperationSource(Client), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, _servicePolicyFragmentPolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Update"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServicePolicyFragmentOperationSource(Client), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, _servicePolicyFragmentPolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists policy resources that reference the policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences + /// + /// + /// Operation Id + /// PolicyFragment_ListReferences + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReferencesAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListReferencesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ResourceCollectionValueItem.DeserializeResourceCollectionValueItem, _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, "ServicePolicyFragmentResource.GetReferences", "value", null, cancellationToken); + } + + /// + /// Lists policy resources that reference the policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences + /// + /// + /// Operation Id + /// PolicyFragment_ListReferences + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReferences(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListReferencesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ResourceCollectionValueItem.DeserializeResourceCollectionValueItem, _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, "ServicePolicyFragmentResource.GetReferences", "value", null, cancellationToken); + } + + /// + /// Gets the entity state (Etag) version of a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.GetEntityTag"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkCollection.cs new file mode 100644 index 000000000000..1f3bdf45c818 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceProductApiLinks method from an instance of . + /// + public partial class ServiceProductApiLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceProductApiLinkProductApiLinkClientDiagnostics; + private readonly ProductApiLinkRestOperations _serviceProductApiLinkProductApiLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductApiLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceProductApiLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductApiLinkProductApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceProductApiLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceProductApiLinkResource.ResourceType, out string serviceProductApiLinkProductApiLinkApiVersion); + _serviceProductApiLinkProductApiLinkRestClient = new ProductApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductApiLinkProductApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceProductResource.ResourceType), nameof(id)); + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the API links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks + /// + /// + /// Operation Id + /// ProductApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductApiLinkProductApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductApiLinkProductApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceProductApiLinkResource(Client, ProductApiLinkContractData.DeserializeProductApiLinkContractData(e)), _serviceProductApiLinkProductApiLinkClientDiagnostics, Pipeline, "ServiceProductApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the API links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks + /// + /// + /// Operation Id + /// ProductApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductApiLinkProductApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductApiLinkProductApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceProductApiLinkResource(Client, ProductApiLinkContractData.DeserializeProductApiLinkContractData(e)), _serviceProductApiLinkProductApiLinkClientDiagnostics, Pipeline, "ServiceProductApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkResource.cs new file mode 100644 index 000000000000..cfbde4989608 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkResource.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceProductApiLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceProductApiLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceProductApiLink method. + /// + public partial class ServiceProductApiLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The productId. + /// The apiLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceProductApiLinkProductApiLinkClientDiagnostics; + private readonly ProductApiLinkRestOperations _serviceProductApiLinkProductApiLinkRestClient; + private readonly ProductApiLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/products/apiLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductApiLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceProductApiLinkResource(ArmClient client, ProductApiLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceProductApiLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductApiLinkProductApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceProductApiLinkProductApiLinkApiVersion); + _serviceProductApiLinkProductApiLinkRestClient = new ProductApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductApiLinkProductApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ProductApiLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductCollection.cs similarity index 68% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductCollection.cs index ff9eff4a70f2..33dcbb4c9ad1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementProducts method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceProducts method from an instance of . /// - public partial class ApiManagementProductCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceProductCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementProductProductClientDiagnostics; - private readonly ProductRestOperations _apiManagementProductProductRestClient; + private readonly ClientDiagnostics _serviceProductProductClientDiagnostics; + private readonly ProductRestOperations _serviceProductProductRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementProductCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceProductCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementProductCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceProductCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementProductResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementProductResource.ResourceType, out string apiManagementProductProductApiVersion); - _apiManagementProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementProductProductApiVersion); + _serviceProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceProductResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceProductResource.ResourceType, out string serviceProductProductApiVersion); + _serviceProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductProductApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -73,17 +73,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.CreateOrUpdate"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementProductResource(Client, response), response.GetRawResponse())); + var response = await _serviceProductProductRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -115,17 +115,17 @@ public virtual async Task> CreateOrUp /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.CreateOrUpdate"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementProductResource(Client, response), response.GetRawResponse())); + var response = _serviceProductProductRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -154,18 +154,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUnt /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string productId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string productId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.Get"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.Get"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -191,18 +191,18 @@ public virtual async Task> GetAsync(strin /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string productId, CancellationToken cancellationToken = default) + public virtual Response Get(string productId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.Get"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.Get"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken); + var response = _serviceProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -230,12 +230,12 @@ public virtual Response Get(string productId, Canc /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. /// Products which are part of a specific tag. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementProductCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _serviceProductProductClientDiagnostics, Pipeline, "ServiceProductCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -257,12 +257,12 @@ public virtual AsyncPageable GetAllAsync(string fi /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. /// Products which are part of a specific tag. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementProductCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _serviceProductProductClientDiagnostics, Pipeline, "ServiceProductCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -286,11 +286,11 @@ public virtual async Task> ExistsAsync(string productId, Cancella { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.Exists"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.Exists"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -321,11 +321,11 @@ public virtual Response Exists(string productId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.Exists"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.Exists"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken); + var response = _serviceProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -352,18 +352,18 @@ public virtual Response Exists(string productId, CancellationToken cancell /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string productId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string productId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.GetIfExists"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.GetIfExists"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -389,18 +389,18 @@ public virtual async Task> GetIfE /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string productId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string productId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.GetIfExists"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.GetIfExists"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken); + var response = _serviceProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -409,7 +409,7 @@ public virtual NullableResponse GetIfExists(string } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -419,7 +419,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkCollection.cs new file mode 100644 index 000000000000..1ca36002274e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceProductGroupLinks method from an instance of . + /// + public partial class ServiceProductGroupLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceProductGroupLinkProductGroupLinkClientDiagnostics; + private readonly ProductGroupLinkRestOperations _serviceProductGroupLinkProductGroupLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductGroupLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceProductGroupLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductGroupLinkProductGroupLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceProductGroupLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceProductGroupLinkResource.ResourceType, out string serviceProductGroupLinkProductGroupLinkApiVersion); + _serviceProductGroupLinkProductGroupLinkRestClient = new ProductGroupLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductGroupLinkProductGroupLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceProductResource.ResourceType), nameof(id)); + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the group links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks + /// + /// + /// Operation Id + /// ProductGroupLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductGroupLinkProductGroupLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductGroupLinkProductGroupLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceProductGroupLinkResource(Client, ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(e)), _serviceProductGroupLinkProductGroupLinkClientDiagnostics, Pipeline, "ServiceProductGroupLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the group links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks + /// + /// + /// Operation Id + /// ProductGroupLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductGroupLinkProductGroupLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductGroupLinkProductGroupLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceProductGroupLinkResource(Client, ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(e)), _serviceProductGroupLinkProductGroupLinkClientDiagnostics, Pipeline, "ServiceProductGroupLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkResource.cs new file mode 100644 index 000000000000..414ac72ca7cf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkResource.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceProductGroupLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceProductGroupLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceProductGroupLink method. + /// + public partial class ServiceProductGroupLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The productId. + /// The groupLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceProductGroupLinkProductGroupLinkClientDiagnostics; + private readonly ProductGroupLinkRestOperations _serviceProductGroupLinkProductGroupLinkRestClient; + private readonly ProductGroupLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/products/groupLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductGroupLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceProductGroupLinkResource(ArmClient client, ProductGroupLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceProductGroupLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductGroupLinkProductGroupLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceProductGroupLinkProductGroupLinkApiVersion); + _serviceProductGroupLinkProductGroupLinkRestClient = new ProductGroupLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductGroupLinkProductGroupLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ProductGroupLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified group from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified group from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductResource.cs similarity index 72% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductResource.cs index 51de4fb1f682..9a47be034c73 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductResource.cs @@ -19,14 +19,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementProduct along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementProductResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementProduct method. + /// A Class representing a ServiceProduct along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceProductResource method. + /// Otherwise you can get one from its parent resource using the GetServiceProduct method. /// - public partial class ApiManagementProductResource : ArmResource + public partial class ServiceProductResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -37,8 +37,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementProductProductClientDiagnostics; - private readonly ProductRestOperations _apiManagementProductProductRestClient; + private readonly ClientDiagnostics _serviceProductProductClientDiagnostics; + private readonly ProductRestOperations _serviceProductProductRestClient; private readonly ClientDiagnostics _productApiClientDiagnostics; private readonly ProductApiRestOperations _productApiRestClient; private readonly ClientDiagnostics _productGroupClientDiagnostics; @@ -50,28 +50,28 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/products"; - /// Initializes a new instance of the class for mocking. - protected ApiManagementProductResource() + /// Initializes a new instance of the class for mocking. + protected ServiceProductResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementProductResource(ArmClient client, ApiManagementProductData data) : this(client, data.Id) + internal ServiceProductResource(ArmClient client, ApiManagementProductData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementProductResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceProductResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementProductProductApiVersion); - _apiManagementProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementProductProductApiVersion); + _serviceProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceProductProductApiVersion); + _serviceProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductProductApiVersion); _productApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _productApiRestClient = new ProductApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _productGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -104,7 +104,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of ApiManagementProductPolicyResources in the ApiManagementProduct. + /// Gets a collection of ApiManagementProductPolicyResources in the ServiceProduct. /// An object representing collection of ApiManagementProductPolicyResources and their operations over a ApiManagementProductPolicyResource. public virtual ApiManagementProductPolicyCollection GetApiManagementProductPolicies() { @@ -155,7 +155,7 @@ public virtual Response GetApiManagementProd return GetApiManagementProductPolicies().Get(policyId, format, cancellationToken); } - /// Gets a collection of ApiManagementProductTagResources in the ApiManagementProduct. + /// Gets a collection of ApiManagementProductTagResources in the ServiceProduct. /// An object representing collection of ApiManagementProductTagResources and their operations over a ApiManagementProductTagResource. public virtual ApiManagementProductTagCollection GetApiManagementProductTags() { @@ -208,6 +208,119 @@ public virtual Response GetApiManagementProduct return GetApiManagementProductTags().Get(tagId, cancellationToken); } + /// Gets an object representing a ServiceProductWikiResource along with the instance operations that can be performed on it in the ServiceProduct. + /// Returns a object. + public virtual ServiceProductWikiResource GetServiceProductWiki() + { + return new ServiceProductWikiResource(Client, Id.AppendChildResource("wikis", "default")); + } + + /// Gets a collection of ServiceProductApiLinkResources in the ServiceProduct. + /// An object representing collection of ServiceProductApiLinkResources and their operations over a ServiceProductApiLinkResource. + public virtual ServiceProductApiLinkCollection GetServiceProductApiLinks() + { + return GetCachedClient(client => new ServiceProductApiLinkCollection(client, Id)); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceProductApiLinkAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceProductApiLinks().GetAsync(apiLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceProductApiLink(string apiLinkId, CancellationToken cancellationToken = default) + { + return GetServiceProductApiLinks().Get(apiLinkId, cancellationToken); + } + + /// Gets a collection of ServiceProductGroupLinkResources in the ServiceProduct. + /// An object representing collection of ServiceProductGroupLinkResources and their operations over a ServiceProductGroupLinkResource. + public virtual ServiceProductGroupLinkCollection GetServiceProductGroupLinks() + { + return GetCachedClient(client => new ServiceProductGroupLinkCollection(client, Id)); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceProductGroupLinkAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceProductGroupLinks().GetAsync(groupLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceProductGroupLink(string groupLinkId, CancellationToken cancellationToken = default) + { + return GetServiceProductGroupLinks().Get(groupLinkId, cancellationToken); + } + /// /// Gets the details of the product specified by its identifier. /// @@ -222,16 +335,16 @@ public virtual Response GetApiManagementProduct /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Get"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Get"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -254,16 +367,16 @@ public virtual async Task> GetAsync(Cance /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Get"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Get"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -291,11 +404,11 @@ public virtual Response Get(CancellationToken canc /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Delete"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Delete"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -327,11 +440,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Delete"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Delete"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken); + var response = _serviceProductProductRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -358,19 +471,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? dele /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiManagementProductPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Update"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Update"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceProductProductRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, productUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -393,19 +506,19 @@ public virtual async Task> UpdateAsync(ET /// /// /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiManagementProductPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Update"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Update"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceProductProductRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, productUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -436,7 +549,7 @@ public virtual AsyncPageable GetProductApisAsync(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _productApiRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productApiRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductApiData.DeserializeProductApiData, _productApiClientDiagnostics, Pipeline, "ApiManagementProductResource.GetProductApis", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductApiData.DeserializeProductApiData, _productApiClientDiagnostics, Pipeline, "ServiceProductResource.GetProductApis", "value", "nextLink", cancellationToken); } /// @@ -461,7 +574,7 @@ public virtual Pageable GetProductApis(string filter = null, int { HttpMessage FirstPageRequest(int? pageSizeHint) => _productApiRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productApiRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductApiData.DeserializeProductApiData, _productApiClientDiagnostics, Pipeline, "ApiManagementProductResource.GetProductApis", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductApiData.DeserializeProductApiData, _productApiClientDiagnostics, Pipeline, "ServiceProductResource.GetProductApis", "value", "nextLink", cancellationToken); } /// @@ -485,7 +598,7 @@ public virtual async Task> CheckProductApiEntityExistsAsync(strin { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.CheckProductApiEntityExists"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.CheckProductApiEntityExists"); scope.Start(); try { @@ -520,7 +633,7 @@ public virtual Response CheckProductApiEntityExists(string apiId, Cancella { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.CheckProductApiEntityExists"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.CheckProductApiEntityExists"); scope.Start(); try { @@ -555,7 +668,7 @@ public virtual async Task> CreateOrUpdateProductApiAsyn { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.CreateOrUpdateProductApi"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.CreateOrUpdateProductApi"); scope.Start(); try { @@ -590,7 +703,7 @@ public virtual Response CreateOrUpdateProductApi(string apiId, C { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.CreateOrUpdateProductApi"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.CreateOrUpdateProductApi"); scope.Start(); try { @@ -625,7 +738,7 @@ public virtual async Task DeleteProductApiAsync(string apiId, Cancella { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.DeleteProductApi"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.DeleteProductApi"); scope.Start(); try { @@ -660,7 +773,7 @@ public virtual Response DeleteProductApi(string apiId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.DeleteProductApi"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.DeleteProductApi"); scope.Start(); try { @@ -696,7 +809,7 @@ public virtual AsyncPageable GetProductGroupsAsync(string filt { HttpMessage FirstPageRequest(int? pageSizeHint) => _productGroupRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productGroupRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductGroupData.DeserializeProductGroupData, _productGroupClientDiagnostics, Pipeline, "ApiManagementProductResource.GetProductGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductGroupData.DeserializeProductGroupData, _productGroupClientDiagnostics, Pipeline, "ServiceProductResource.GetProductGroups", "value", "nextLink", cancellationToken); } /// @@ -721,7 +834,7 @@ public virtual Pageable GetProductGroups(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _productGroupRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productGroupRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductGroupData.DeserializeProductGroupData, _productGroupClientDiagnostics, Pipeline, "ApiManagementProductResource.GetProductGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductGroupData.DeserializeProductGroupData, _productGroupClientDiagnostics, Pipeline, "ServiceProductResource.GetProductGroups", "value", "nextLink", cancellationToken); } /// @@ -745,7 +858,7 @@ public virtual async Task> CheckProductGroupEntityExistsAsync(str { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.CheckProductGroupEntityExists"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.CheckProductGroupEntityExists"); scope.Start(); try { @@ -780,7 +893,7 @@ public virtual Response CheckProductGroupEntityExists(string groupId, Canc { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.CheckProductGroupEntityExists"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.CheckProductGroupEntityExists"); scope.Start(); try { @@ -815,7 +928,7 @@ public virtual async Task> CreateOrUpdateProductGroup { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.CreateOrUpdateProductGroup"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.CreateOrUpdateProductGroup"); scope.Start(); try { @@ -850,7 +963,7 @@ public virtual Response CreateOrUpdateProductGroup(string grou { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.CreateOrUpdateProductGroup"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.CreateOrUpdateProductGroup"); scope.Start(); try { @@ -885,7 +998,7 @@ public virtual async Task DeleteProductGroupAsync(string groupId, Canc { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.DeleteProductGroup"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.DeleteProductGroup"); scope.Start(); try { @@ -920,7 +1033,7 @@ public virtual Response DeleteProductGroup(string groupId, CancellationToken can { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.DeleteProductGroup"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.DeleteProductGroup"); scope.Start(); try { @@ -934,6 +1047,56 @@ public virtual Response DeleteProductGroup(string groupId, CancellationToken can } } + /// + /// Lists the collection of subscriptions to the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions + /// + /// + /// Operation Id + /// ProductSubscriptions_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllProductSubscriptionDataAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _productSubscriptionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productSubscriptionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SubscriptionContractData.DeserializeSubscriptionContractData, _productSubscriptionsClientDiagnostics, Pipeline, "ServiceProductResource.GetAllProductSubscriptionData", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the collection of subscriptions to the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions + /// + /// + /// Operation Id + /// ProductSubscriptions_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllProductSubscriptionData(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _productSubscriptionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productSubscriptionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SubscriptionContractData.DeserializeSubscriptionContractData, _productSubscriptionsClientDiagnostics, Pipeline, "ServiceProductResource.GetAllProductSubscriptionData", "value", "nextLink", cancellationToken); + } + /// /// Gets the entity state (Etag) version of the product specified by its identifier. /// @@ -950,11 +1113,11 @@ public virtual Response DeleteProductGroup(string groupId, CancellationToken can /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.GetEntityTag"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.GetEntityTag"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -980,11 +1143,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.GetEntityTag"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.GetEntityTag"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceProductProductRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductWikiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductWikiResource.cs new file mode 100644 index 000000000000..740b51bf8c7a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductWikiResource.cs @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceProductWiki along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceProductWikiResource method. + /// Otherwise you can get one from its parent resource using the GetServiceProductWiki method. + /// + public partial class ServiceProductWikiResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The productId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceProductWikiProductWikiClientDiagnostics; + private readonly ProductWikiRestOperations _serviceProductWikiProductWikiRestClient; + private readonly WikiContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/products/wikis"; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductWikiResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceProductWikiResource(ArmClient client, WikiContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceProductWikiResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductWikiProductWikiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceProductWikiProductWikiApiVersion); + _serviceProductWikiProductWikiRestClient = new ProductWikiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductWikiProductWikiApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WikiContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Get"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Get"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Wiki from a Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Delete"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Wiki from a Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Delete"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Wiki Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Update"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, wikiUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceProductWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Wiki Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Update"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, wikiUpdateContract, cancellationToken); + return Response.FromValue(new ServiceProductWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Wiki for a Product or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductWikiResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Wiki for a Product or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductWikiResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaCollection.cs similarity index 65% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaCollection.cs index f39681072831..af15d98458e6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementGlobalSchemas method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceSchemas method from an instance of . /// - public partial class ApiManagementGlobalSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics; - private readonly GlobalSchemaRestOperations _apiManagementGlobalSchemaGlobalSchemaRestClient; + private readonly ClientDiagnostics _serviceSchemaGlobalSchemaClientDiagnostics; + private readonly GlobalSchemaRestOperations _serviceSchemaGlobalSchemaRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementGlobalSchemaCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceSchemaCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementGlobalSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementGlobalSchemaResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementGlobalSchemaResource.ResourceType, out string apiManagementGlobalSchemaGlobalSchemaApiVersion); - _apiManagementGlobalSchemaGlobalSchemaRestClient = new GlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementGlobalSchemaGlobalSchemaApiVersion); + _serviceSchemaGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceSchemaResource.ResourceType, out string serviceSchemaGlobalSchemaApiVersion); + _serviceSchemaGlobalSchemaRestClient = new GlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceSchemaGlobalSchemaApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -73,17 +73,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.CreateOrUpdate"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementGlobalSchemaOperationSource(Client), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceSchemaGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceSchemaOperationSource(Client), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, _serviceSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -115,17 +115,17 @@ public virtual async Task> Creat /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.CreateOrUpdate"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementGlobalSchemaOperationSource(Client), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceSchemaGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceSchemaOperationSource(Client), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, _serviceSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -154,18 +154,18 @@ public virtual ArmOperation CreateOrUpdate(Wa /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.Get"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.Get"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -191,18 +191,18 @@ public virtual async Task> GetAsync( /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) + public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.Get"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.Get"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -228,12 +228,12 @@ public virtual Response Get(string schemaId, /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGlobalSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, "ApiManagementGlobalSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, "ServiceSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,12 +253,12 @@ public virtual AsyncPageable GetAllAsync(stri /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGlobalSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, "ApiManagementGlobalSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, "ServiceSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -282,11 +282,11 @@ public virtual async Task> ExistsAsync(string schemaId, Cancellat { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.Exists"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.Exists"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -317,11 +317,11 @@ public virtual Response Exists(string schemaId, CancellationToken cancella { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.Exists"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.Exists"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -348,18 +348,18 @@ public virtual Response Exists(string schemaId, CancellationToken cancella /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.GetIfExists"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.GetIfExists"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -385,18 +385,18 @@ public virtual async Task> G /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string schemaId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.GetIfExists"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.GetIfExists"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -405,7 +405,7 @@ public virtual NullableResponse GetIfExists(s } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -415,7 +415,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaResource.cs similarity index 70% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaResource.cs index 6d22d18dac42..3335aaffcba4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaResource.cs @@ -17,14 +17,14 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementGlobalSchema along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementGlobalSchemaResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementGlobalSchema method. + /// A Class representing a ServiceSchema along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetServiceSchema method. /// - public partial class ApiManagementGlobalSchemaResource : ArmResource + public partial class ServiceSchemaResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The serviceName. @@ -35,35 +35,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics; - private readonly GlobalSchemaRestOperations _apiManagementGlobalSchemaGlobalSchemaRestClient; + private readonly ClientDiagnostics _serviceSchemaGlobalSchemaClientDiagnostics; + private readonly GlobalSchemaRestOperations _serviceSchemaGlobalSchemaRestClient; private readonly ApiManagementGlobalSchemaData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/schemas"; - /// Initializes a new instance of the class for mocking. - protected ApiManagementGlobalSchemaResource() + /// Initializes a new instance of the class for mocking. + protected ServiceSchemaResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementGlobalSchemaResource(ArmClient client, ApiManagementGlobalSchemaData data) : this(client, data.Id) + internal ServiceSchemaResource(ArmClient client, ApiManagementGlobalSchemaData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementGlobalSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementGlobalSchemaGlobalSchemaApiVersion); - _apiManagementGlobalSchemaGlobalSchemaRestClient = new GlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementGlobalSchemaGlobalSchemaApiVersion); + _serviceSchemaGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceSchemaGlobalSchemaApiVersion); + _serviceSchemaGlobalSchemaRestClient = new GlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceSchemaGlobalSchemaApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -104,16 +104,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Get"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Get"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -136,16 +136,16 @@ public virtual async Task> GetAsync( /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Get"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Get"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -172,11 +172,11 @@ public virtual Response Get(CancellationToken /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Delete"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Delete"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -207,11 +207,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Delete"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Delete"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -242,16 +242,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Update"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Update"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementGlobalSchemaOperationSource(Client), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceSchemaGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceSchemaOperationSource(Client), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, _serviceSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -281,16 +281,16 @@ public virtual async Task> Updat /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Update"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Update"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementGlobalSchemaOperationSource(Client), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceSchemaGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceSchemaOperationSource(Client), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, _serviceSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -318,11 +318,11 @@ public virtual ArmOperation Update(WaitUntil /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.GetEntityTag"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.GetEntityTag"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -348,11 +348,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.GetEntityTag"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.GetEntityTag"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkCollection.cs new file mode 100644 index 000000000000..6f95284df7ec --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceTagApiLinks method from an instance of . + /// + public partial class ServiceTagApiLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceTagApiLinkTagApiLinkClientDiagnostics; + private readonly TagApiLinkRestOperations _serviceTagApiLinkTagApiLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagApiLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceTagApiLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagApiLinkTagApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceTagApiLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceTagApiLinkResource.ResourceType, out string serviceTagApiLinkTagApiLinkApiVersion); + _serviceTagApiLinkTagApiLinkRestClient = new TagApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagApiLinkTagApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the API links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks + /// + /// + /// Operation Id + /// TagApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagApiLinkTagApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagApiLinkTagApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceTagApiLinkResource(Client, TagApiLinkContractData.DeserializeTagApiLinkContractData(e)), _serviceTagApiLinkTagApiLinkClientDiagnostics, Pipeline, "ServiceTagApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the API links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks + /// + /// + /// Operation Id + /// TagApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagApiLinkTagApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagApiLinkTagApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceTagApiLinkResource(Client, TagApiLinkContractData.DeserializeTagApiLinkContractData(e)), _serviceTagApiLinkTagApiLinkClientDiagnostics, Pipeline, "ServiceTagApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkResource.cs new file mode 100644 index 000000000000..958d057e1b2c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkResource.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceTagApiLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceTagApiLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceTagApiLink method. + /// + public partial class ServiceTagApiLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The tagId. + /// The apiLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceTagApiLinkTagApiLinkClientDiagnostics; + private readonly TagApiLinkRestOperations _serviceTagApiLinkTagApiLinkRestClient; + private readonly TagApiLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/tags/apiLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagApiLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceTagApiLinkResource(ArmClient client, TagApiLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceTagApiLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagApiLinkTagApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceTagApiLinkTagApiLinkApiVersion); + _serviceTagApiLinkTagApiLinkRestClient = new TagApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagApiLinkTagApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagApiLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkCollection.cs new file mode 100644 index 000000000000..6f4a3b5825cd --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceTagOperationLinks method from an instance of . + /// + public partial class ServiceTagOperationLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceTagOperationLinkTagOperationLinkClientDiagnostics; + private readonly TagOperationLinkRestOperations _serviceTagOperationLinkTagOperationLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagOperationLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceTagOperationLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagOperationLinkTagOperationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceTagOperationLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceTagOperationLinkResource.ResourceType, out string serviceTagOperationLinkTagOperationLinkApiVersion); + _serviceTagOperationLinkTagOperationLinkRestClient = new TagOperationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagOperationLinkTagOperationLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the operation links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks + /// + /// + /// Operation Id + /// TagOperationLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagOperationLinkTagOperationLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagOperationLinkTagOperationLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceTagOperationLinkResource(Client, TagOperationLinkContractData.DeserializeTagOperationLinkContractData(e)), _serviceTagOperationLinkTagOperationLinkClientDiagnostics, Pipeline, "ServiceTagOperationLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the operation links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks + /// + /// + /// Operation Id + /// TagOperationLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagOperationLinkTagOperationLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagOperationLinkTagOperationLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceTagOperationLinkResource(Client, TagOperationLinkContractData.DeserializeTagOperationLinkContractData(e)), _serviceTagOperationLinkTagOperationLinkClientDiagnostics, Pipeline, "ServiceTagOperationLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkResource.cs new file mode 100644 index 000000000000..4232eb2c77da --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkResource.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceTagOperationLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceTagOperationLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceTagOperationLink method. + /// + public partial class ServiceTagOperationLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The tagId. + /// The operationLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceTagOperationLinkTagOperationLinkClientDiagnostics; + private readonly TagOperationLinkRestOperations _serviceTagOperationLinkTagOperationLinkRestClient; + private readonly TagOperationLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/tags/operationLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagOperationLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceTagOperationLinkResource(ArmClient client, TagOperationLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceTagOperationLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagOperationLinkTagOperationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceTagOperationLinkTagOperationLinkApiVersion); + _serviceTagOperationLinkTagOperationLinkRestClient = new TagOperationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagOperationLinkTagOperationLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagOperationLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkCollection.cs new file mode 100644 index 000000000000..69cf74cfe806 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceTagProductLinks method from an instance of . + /// + public partial class ServiceTagProductLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceTagProductLinkTagProductLinkClientDiagnostics; + private readonly TagProductLinkRestOperations _serviceTagProductLinkTagProductLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagProductLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceTagProductLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagProductLinkTagProductLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceTagProductLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceTagProductLinkResource.ResourceType, out string serviceTagProductLinkTagProductLinkApiVersion); + _serviceTagProductLinkTagProductLinkRestClient = new TagProductLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagProductLinkTagProductLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the product links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks + /// + /// + /// Operation Id + /// TagProductLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagProductLinkTagProductLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagProductLinkTagProductLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceTagProductLinkResource(Client, TagProductLinkContractData.DeserializeTagProductLinkContractData(e)), _serviceTagProductLinkTagProductLinkClientDiagnostics, Pipeline, "ServiceTagProductLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the product links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks + /// + /// + /// Operation Id + /// TagProductLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagProductLinkTagProductLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagProductLinkTagProductLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceTagProductLinkResource(Client, TagProductLinkContractData.DeserializeTagProductLinkContractData(e)), _serviceTagProductLinkTagProductLinkClientDiagnostics, Pipeline, "ServiceTagProductLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkResource.cs new file mode 100644 index 000000000000..13414d7b086a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkResource.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceTagProductLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceTagProductLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceTagProductLink method. + /// + public partial class ServiceTagProductLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The tagId. + /// The productLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceTagProductLinkTagProductLinkClientDiagnostics; + private readonly TagProductLinkRestOperations _serviceTagProductLinkTagProductLinkRestClient; + private readonly TagProductLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/tags/productLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagProductLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceTagProductLinkResource(ArmClient client, TagProductLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceTagProductLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagProductLinkTagProductLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceTagProductLinkTagProductLinkApiVersion); + _serviceTagProductLinkTagProductLinkRestClient = new TagProductLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagProductLinkTagProductLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagProductLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified product from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified product from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiCollection.cs new file mode 100644 index 000000000000..14f261637324 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiCollection.cs @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApis method from an instance of . + /// + public partial class ServiceWorkspaceApiCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiWorkspaceApiClientDiagnostics; + private readonly WorkspaceApiRestOperations _serviceWorkspaceApiWorkspaceApiRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiWorkspaceApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiResource.ResourceType, out string serviceWorkspaceApiWorkspaceApiApiVersion); + _serviceWorkspaceApiWorkspaceApiRestClient = new WorkspaceApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiWorkspaceApiApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates new or updates existing specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiOperationSource(Client), _serviceWorkspaceApiWorkspaceApiClientDiagnostics, Pipeline, _serviceWorkspaceApiWorkspaceApiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates existing specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiOperationSource(Client), _serviceWorkspaceApiWorkspaceApiClientDiagnostics, Pipeline, _serviceWorkspaceApiWorkspaceApiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all APIs of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis + /// + /// + /// Operation Id + /// WorkspaceApi_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiWorkspaceApiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags, expandApiVersionSet); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiWorkspaceApiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags, expandApiVersionSet); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiResource(Client, ApiData.DeserializeApiData(e)), _serviceWorkspaceApiWorkspaceApiClientDiagnostics, Pipeline, "ServiceWorkspaceApiCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all APIs of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis + /// + /// + /// Operation Id + /// WorkspaceApi_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiWorkspaceApiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags, expandApiVersionSet); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiWorkspaceApiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags, expandApiVersionSet); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiResource(Client, ApiData.DeserializeApiData(e)), _serviceWorkspaceApiWorkspaceApiClientDiagnostics, Pipeline, "ServiceWorkspaceApiCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationCollection.cs new file mode 100644 index 000000000000..d15f265a6696 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationCollection.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiOperations method from an instance of . + /// + public partial class ServiceWorkspaceApiOperationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics; + private readonly WorkspaceApiOperationRestOperations _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiOperationCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiOperationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiOperationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiOperationResource.ResourceType, out string serviceWorkspaceApiOperationWorkspaceApiOperationApiVersion); + _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient = new WorkspaceApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiOperationWorkspaceApiOperationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new operation in the API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new operation in the API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the operations for the specified API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations + /// + /// + /// Operation Id + /// WorkspaceApiOperation_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip, tags); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics, Pipeline, "ServiceWorkspaceApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the operations for the specified API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations + /// + /// + /// Operation Id + /// WorkspaceApiOperation_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip, tags); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics, Pipeline, "ServiceWorkspaceApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyCollection.cs new file mode 100644 index 000000000000..9cfa47bb6b91 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyCollection.cs @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiOperationPolicies method from an instance of . + /// + public partial class ServiceWorkspaceApiOperationPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics; + private readonly WorkspaceApiOperationPolicyRestOperations _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiOperationPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiOperationPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiOperationPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiOperationPolicyResource.ResourceType, out string serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyApiVersion); + _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient = new WorkspaceApiOperationPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiOperationResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiOperationResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the list of policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_ListByOperation + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateListByOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateListByOperationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiOperationPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceApiOperationPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_ListByOperation + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateListByOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateListByOperationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiOperationPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceApiOperationPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyResource.cs new file mode 100644 index 000000000000..3ca2bd4407d2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyResource.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiOperationPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiOperationPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiOperationPolicy method. + /// + public partial class ServiceWorkspaceApiOperationPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The apiId. + /// The operationId. + /// The policyId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics; + private readonly WorkspaceApiOperationPolicyRestOperations _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient; + private readonly PolicyContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/operations/policies"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiOperationPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiOperationPolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiOperationPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyApiVersion); + _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient = new WorkspaceApiOperationPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Api Operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Api Operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationResource.cs new file mode 100644 index 000000000000..443beba7941b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationResource.cs @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiOperation along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiOperationResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiOperation method. + /// + public partial class ServiceWorkspaceApiOperationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The apiId. + /// The operationId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics; + private readonly WorkspaceApiOperationRestOperations _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient; + private readonly ApiOperationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/operations"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiOperationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiOperationResource(ArmClient client, ApiOperationData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiOperationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiOperationWorkspaceApiOperationApiVersion); + _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient = new WorkspaceApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiOperationWorkspaceApiOperationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiOperationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceApiOperationPolicyResources in the ServiceWorkspaceApiOperation. + /// An object representing collection of ServiceWorkspaceApiOperationPolicyResources and their operations over a ServiceWorkspaceApiOperationPolicyResource. + public virtual ServiceWorkspaceApiOperationPolicyCollection GetServiceWorkspaceApiOperationPolicies() + { + return GetCachedClient(client => new ServiceWorkspaceApiOperationPolicyCollection(client, Id)); + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiOperationPolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiOperationPolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiOperationPolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiOperationPolicies().Get(policyId, format, cancellationToken); + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation in the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation in the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the operation in the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Operation Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, operationUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the operation in the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Operation Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, operationUpdateContract, cancellationToken); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyCollection.cs new file mode 100644 index 000000000000..5ca33fa80a78 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyCollection.cs @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiPolicies method from an instance of . + /// + public partial class ServiceWorkspaceApiPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics; + private readonly WorkspaceApiPolicyRestOperations _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiPolicyResource.ResourceType, out string serviceWorkspaceApiPolicyWorkspaceApiPolicyApiVersion); + _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient = new WorkspaceApiPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiPolicyWorkspaceApiPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_ListByApi + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceApiPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_ListByApi + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceApiPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyResource.cs new file mode 100644 index 000000000000..7a26be11cdcb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyResource.cs @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiPolicy method. + /// + public partial class ServiceWorkspaceApiPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The apiId. + /// The policyId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics; + private readonly WorkspaceApiPolicyRestOperations _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient; + private readonly PolicyContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/policies"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiPolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiPolicyWorkspaceApiPolicyApiVersion); + _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient = new WorkspaceApiPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiPolicyWorkspaceApiPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Api. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Api. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseCollection.cs new file mode 100644 index 000000000000..b5ba36f009e2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiReleases method from an instance of . + /// + public partial class ServiceWorkspaceApiReleaseCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics; + private readonly WorkspaceApiReleaseRestOperations _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiReleaseCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiReleaseCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiReleaseResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiReleaseResource.ResourceType, out string serviceWorkspaceApiReleaseWorkspaceApiReleaseApiVersion); + _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient = new WorkspaceApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiReleaseWorkspaceApiReleaseApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new Release for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Release for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases + /// + /// + /// Operation Id + /// WorkspaceApiRelease_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics, Pipeline, "ServiceWorkspaceApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases + /// + /// + /// Operation Id + /// WorkspaceApiRelease_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics, Pipeline, "ServiceWorkspaceApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseResource.cs new file mode 100644 index 000000000000..4e5f96ebf7d5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseResource.cs @@ -0,0 +1,359 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiRelease along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiReleaseResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiRelease method. + /// + public partial class ServiceWorkspaceApiReleaseResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The apiId. + /// The releaseId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics; + private readonly WorkspaceApiReleaseRestOperations _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient; + private readonly ApiReleaseData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/releases"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiReleaseResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiReleaseResource(ArmClient client, ApiReleaseData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiReleaseResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiReleaseWorkspaceApiReleaseApiVersion); + _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient = new WorkspaceApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiReleaseWorkspaceApiReleaseApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiReleaseData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified release in the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified release in the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the release of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Release Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the release of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Release Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the etag of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the etag of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiResource.cs new file mode 100644 index 000000000000..67eb62271e8c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiResource.cs @@ -0,0 +1,626 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApi along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApi method. + /// + public partial class ServiceWorkspaceApiResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The apiId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiWorkspaceApiClientDiagnostics; + private readonly WorkspaceApiRestOperations _serviceWorkspaceApiWorkspaceApiRestClient; + private readonly ClientDiagnostics _workspaceApiRevisionClientDiagnostics; + private readonly WorkspaceApiRevisionRestOperations _workspaceApiRevisionRestClient; + private readonly ApiData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiResource(ArmClient client, ApiData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiWorkspaceApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiWorkspaceApiApiVersion); + _serviceWorkspaceApiWorkspaceApiRestClient = new WorkspaceApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiWorkspaceApiApiVersion); + _workspaceApiRevisionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workspaceApiRevisionRestClient = new WorkspaceApiRevisionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceApiReleaseResources in the ServiceWorkspaceApi. + /// An object representing collection of ServiceWorkspaceApiReleaseResources and their operations over a ServiceWorkspaceApiReleaseResource. + public virtual ServiceWorkspaceApiReleaseCollection GetServiceWorkspaceApiReleases() + { + return GetCachedClient(client => new ServiceWorkspaceApiReleaseCollection(client, Id)); + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiReleaseAsync(string releaseId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiReleases().GetAsync(releaseId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiRelease(string releaseId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiReleases().Get(releaseId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceApiOperationResources in the ServiceWorkspaceApi. + /// An object representing collection of ServiceWorkspaceApiOperationResources and their operations over a ServiceWorkspaceApiOperationResource. + public virtual ServiceWorkspaceApiOperationCollection GetServiceWorkspaceApiOperations() + { + return GetCachedClient(client => new ServiceWorkspaceApiOperationCollection(client, Id)); + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiOperationAsync(string operationId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiOperations().GetAsync(operationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiOperation(string operationId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiOperations().Get(operationId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceApiPolicyResources in the ServiceWorkspaceApi. + /// An object representing collection of ServiceWorkspaceApiPolicyResources and their operations over a ServiceWorkspaceApiPolicyResource. + public virtual ServiceWorkspaceApiPolicyCollection GetServiceWorkspaceApiPolicies() + { + return GetCachedClient(client => new ServiceWorkspaceApiPolicyCollection(client, Id)); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiPolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiPolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiPolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiPolicies().Get(policyId, format, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceApiSchemaResources in the ServiceWorkspaceApi. + /// An object representing collection of ServiceWorkspaceApiSchemaResources and their operations over a ServiceWorkspaceApiSchemaResource. + public virtual ServiceWorkspaceApiSchemaCollection GetServiceWorkspaceApiSchemas() + { + return GetCachedClient(client => new ServiceWorkspaceApiSchemaCollection(client, Id)); + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiSchemaAsync(string schemaId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiSchema(string schemaId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiSchemas().Get(schemaId, cancellationToken); + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Delete all revisions of the Api. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Delete all revisions of the Api. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Update Contract parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, apiUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// API Update Contract parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, apiUpdateContract, cancellationToken); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all revisions of an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/revisions + /// + /// + /// Operation Id + /// WorkspaceApiRevision_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkspaceApiRevisionsByServiceAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceApiRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceApiRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _workspaceApiRevisionClientDiagnostics, Pipeline, "ServiceWorkspaceApiResource.GetWorkspaceApiRevisionsByService", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all revisions of an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/revisions + /// + /// + /// Operation Id + /// WorkspaceApiRevision_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkspaceApiRevisionsByService(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceApiRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceApiRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _workspaceApiRevisionClientDiagnostics, Pipeline, "ServiceWorkspaceApiResource.GetWorkspaceApiRevisionsByService", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the entity state (Etag) version of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaCollection.cs new file mode 100644 index 000000000000..37c83e799f0d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiSchemas method from an instance of . + /// + public partial class ServiceWorkspaceApiSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics; + private readonly WorkspaceApiSchemaRestOperations _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiSchemaCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiSchemaResource.ResourceType, out string serviceWorkspaceApiSchemaWorkspaceApiSchemaApiVersion); + _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient = new WorkspaceApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiSchemaWorkspaceApiSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates schema configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiSchemaOperationSource(Client), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates schema configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiSchemaOperationSource(Client), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas + /// + /// + /// Operation Id + /// WorkspaceApiSchema_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, "ServiceWorkspaceApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas + /// + /// + /// Operation Id + /// WorkspaceApiSchema_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, "ServiceWorkspaceApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaResource.cs new file mode 100644 index 000000000000..6b08103bcff9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaResource.cs @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiSchema along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiSchema method. + /// + public partial class ServiceWorkspaceApiSchemaResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The apiId. + /// The schemaId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics; + private readonly WorkspaceApiSchemaRestOperations _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient; + private readonly ApiSchemaData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/schemas"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiSchemaResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiSchemaResource(ArmClient client, ApiSchemaData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiSchemaWorkspaceApiSchemaApiVersion); + _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient = new WorkspaceApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiSchemaWorkspaceApiSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiSchemaData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the schema configuration at the Api. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// If true removes all references to the schema before deleting it. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the schema configuration at the Api. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// If true removes all references to the schema before deleting it. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates schema configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiSchemaOperationSource(Client), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates schema configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiSchemaOperationSource(Client), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetCollection.cs new file mode 100644 index 000000000000..390b331a59b9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiVersionSets method from an instance of . + /// + public partial class ServiceWorkspaceApiVersionSetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics; + private readonly WorkspaceApiVersionSetRestOperations _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiVersionSetCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiVersionSetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiVersionSetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiVersionSetResource.ResourceType, out string serviceWorkspaceApiVersionSetWorkspaceApiVersionSetApiVersion); + _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient = new WorkspaceApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiVersionSetWorkspaceApiVersionSetApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or Updates a Api Version Set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates a Api Version Set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics, Pipeline, "ServiceWorkspaceApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics, Pipeline, "ServiceWorkspaceApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetResource.cs new file mode 100644 index 000000000000..61075bf5688a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetResource.cs @@ -0,0 +1,359 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiVersionSet along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiVersionSetResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiVersionSet method. + /// + public partial class ServiceWorkspaceApiVersionSetResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The versionSetId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics; + private readonly WorkspaceApiVersionSetRestOperations _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient; + private readonly ApiVersionSetData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apiVersionSets"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiVersionSetResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiVersionSetResource(ArmClient client, ApiVersionSetData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiVersionSetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiVersionSetWorkspaceApiVersionSetApiVersion); + _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient = new WorkspaceApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiVersionSetWorkspaceApiVersionSetApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiVersionSetData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Api Version Set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Api Version Set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Api VersionSet specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, apiVersionSetUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Api VersionSet specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, apiVersionSetUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupCollection.cs new file mode 100644 index 000000000000..e0e6b997091d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupCollection.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceGroups method from an instance of . + /// + public partial class ServiceWorkspaceGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics; + private readonly WorkspaceGroupRestOperations _serviceWorkspaceGroupWorkspaceGroupRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceGroupCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceGroupResource.ResourceType, out string serviceWorkspaceGroupWorkspaceGroupApiVersion); + _serviceWorkspaceGroupWorkspaceGroupRestClient = new WorkspaceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceGroupWorkspaceGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or Updates a group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Group identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, groupCreateParameters, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceGroupResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates a group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Group identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, groupCreateParameters, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceGroupResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of groups defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups + /// + /// + /// Operation Id + /// WorkspaceGroup_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics, Pipeline, "ServiceWorkspaceGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of groups defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups + /// + /// + /// Operation Id + /// WorkspaceGroup_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics, Pipeline, "ServiceWorkspaceGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupResource.cs new file mode 100644 index 000000000000..5b7d8b61ab94 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupResource.cs @@ -0,0 +1,624 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceGroup along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceGroupResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceGroup method. + /// + public partial class ServiceWorkspaceGroupResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The groupId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics; + private readonly WorkspaceGroupRestOperations _serviceWorkspaceGroupWorkspaceGroupRestClient; + private readonly ClientDiagnostics _workspaceGroupUserClientDiagnostics; + private readonly WorkspaceGroupUserRestOperations _workspaceGroupUserRestClient; + private readonly ApiManagementGroupData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/groups"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceGroupResource(ArmClient client, ApiManagementGroupData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceGroupWorkspaceGroupApiVersion); + _serviceWorkspaceGroupWorkspaceGroupRestClient = new WorkspaceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceGroupWorkspaceGroupApiVersion); + _workspaceGroupUserClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workspaceGroupUserRestClient = new WorkspaceGroupUserRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementGroupData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific group of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific group of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, groupUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, groupUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of user entities associated with the group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users + /// + /// + /// Operation Id + /// WorkspaceGroupUser_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkspaceGroupUsersAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceGroupUserRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceGroupUserRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementUserResource(Client, UserContractData.DeserializeUserContractData(e)), _workspaceGroupUserClientDiagnostics, Pipeline, "ServiceWorkspaceGroupResource.GetWorkspaceGroupUsers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of user entities associated with the group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users + /// + /// + /// Operation Id + /// WorkspaceGroupUser_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkspaceGroupUsers(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceGroupUserRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceGroupUserRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementUserResource(Client, UserContractData.DeserializeUserContractData(e)), _workspaceGroupUserClientDiagnostics, Pipeline, "ServiceWorkspaceGroupResource.GetWorkspaceGroupUsers", "value", "nextLink", cancellationToken); + } + + /// + /// Checks that user entity specified by identifier is associated with the group entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_CheckEntityExists + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CheckEntityExistsWorkspaceGroupUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.CheckEntityExistsWorkspaceGroupUser"); + scope.Start(); + try + { + var response = await _workspaceGroupUserRestClient.CheckEntityExistsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that user entity specified by identifier is associated with the group entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_CheckEntityExists + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CheckEntityExistsWorkspaceGroupUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.CheckEntityExistsWorkspaceGroupUser"); + scope.Start(); + try + { + var response = _workspaceGroupUserRestClient.CheckEntityExists(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add existing user to existing group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_Create + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CreateWorkspaceGroupUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.CreateWorkspaceGroupUser"); + scope.Start(); + try + { + var response = await _workspaceGroupUserRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ApiManagementUserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add existing user to existing group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_Create + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CreateWorkspaceGroupUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.CreateWorkspaceGroupUser"); + scope.Start(); + try + { + var response = _workspaceGroupUserRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return Response.FromValue(new ApiManagementUserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Remove existing user from existing group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_Delete + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkspaceGroupUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.DeleteWorkspaceGroupUser"); + scope.Start(); + try + { + var response = await _workspaceGroupUserRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Remove existing user from existing group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_Delete + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DeleteWorkspaceGroupUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.DeleteWorkspaceGroupUser"); + scope.Start(); + try + { + var response = _workspaceGroupUserRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueCollection.cs new file mode 100644 index 000000000000..a76dea74a82f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueCollection.cs @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceNamedValues method from an instance of . + /// + public partial class ServiceWorkspaceNamedValueCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics; + private readonly WorkspaceNamedValueRestOperations _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceNamedValueCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceNamedValueCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceNamedValueResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceNamedValueResource.ResourceType, out string serviceWorkspaceNamedValueWorkspaceNamedValueApiVersion); + _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient = new WorkspaceNamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceNamedValueWorkspaceNamedValueApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates named value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the NamedValue. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, namedValueCreateContract, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, namedValueCreateContract, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates named value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the NamedValue. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, namedValueCreateContract, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, namedValueCreateContract, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of named values defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues + /// + /// + /// Operation Id + /// WorkspaceNamedValue_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Query parameter to fetch named value entities based on refresh status. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, KeyVaultRefreshState? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, "ServiceWorkspaceNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of named values defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues + /// + /// + /// Operation Id + /// WorkspaceNamedValue_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Query parameter to fetch named value entities based on refresh status. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, KeyVaultRefreshState? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, "ServiceWorkspaceNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueResource.cs new file mode 100644 index 000000000000..932c7cdfd795 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueResource.cs @@ -0,0 +1,495 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceNamedValue along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceNamedValueResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceNamedValue method. + /// + public partial class ServiceWorkspaceNamedValueResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The namedValueId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics; + private readonly WorkspaceNamedValueRestOperations _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient; + private readonly ApiManagementNamedValueData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/namedValues"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceNamedValueResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceNamedValueResource(ArmClient client, ApiManagementNamedValueData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceNamedValueResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceNamedValueWorkspaceNamedValueApiVersion); + _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient = new WorkspaceNamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceNamedValueWorkspaceNamedValueApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementNamedValueData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific named value from the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific named value from the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specific named value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Update + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specific named value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Update + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the secret of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/listValue + /// + /// + /// Operation Id + /// WorkspaceNamedValue_ListValue + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetValueAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.GetValue"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.ListValueAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the secret of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/listValue + /// + /// + /// Operation Id + /// WorkspaceNamedValue_ListValue + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetValue(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.GetValue"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.ListValue(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret + /// + /// + /// Operation Id + /// WorkspaceNamedValue_RefreshSecret + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> RefreshSecretAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.RefreshSecret"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.RefreshSecretAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret + /// + /// + /// Operation Id + /// WorkspaceNamedValue_RefreshSecret + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation RefreshSecret(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.RefreshSecret"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.RefreshSecret(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationCollection.cs new file mode 100644 index 000000000000..ca2a5fdc12e0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationCollection.cs @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceNotifications method from an instance of . + /// + public partial class ServiceWorkspaceNotificationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics; + private readonly WorkspaceNotificationRestOperations _serviceWorkspaceNotificationWorkspaceNotificationRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceNotificationCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceNotificationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceNotificationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceNotificationResource.ResourceType, out string serviceWorkspaceNotificationWorkspaceNotificationApiVersion); + _serviceWorkspaceNotificationWorkspaceNotificationRestClient = new WorkspaceNotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceNotificationWorkspaceNotificationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Create or Update API Management publisher notification for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Notification Name Identifier. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update API Management publisher notification for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Notification Name Identifier. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual async Task> GetAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual Response Get(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of properties defined within a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications + /// + /// + /// Operation Id + /// WorkspaceNotification_ListByService + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of properties defined within a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications + /// + /// + /// Operation Id + /// WorkspaceNotification_ListByService + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual Response Exists(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationResource.cs new file mode 100644 index 000000000000..a2ae30e91f97 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationResource.cs @@ -0,0 +1,742 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceNotification along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceNotificationResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceNotification method. + /// + public partial class ServiceWorkspaceNotificationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The notificationName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics; + private readonly WorkspaceNotificationRestOperations _serviceWorkspaceNotificationWorkspaceNotificationRestClient; + private readonly ClientDiagnostics _workspaceNotificationRecipientUserClientDiagnostics; + private readonly WorkspaceNotificationRecipientUserRestOperations _workspaceNotificationRecipientUserRestClient; + private readonly ClientDiagnostics _workspaceNotificationRecipientEmailClientDiagnostics; + private readonly WorkspaceNotificationRecipientEmailRestOperations _workspaceNotificationRecipientEmailRestClient; + private readonly ApiManagementNotificationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/notifications"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceNotificationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceNotificationResource(ArmClient client, ApiManagementNotificationData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceNotificationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceNotificationWorkspaceNotificationApiVersion); + _serviceWorkspaceNotificationWorkspaceNotificationRestClient = new WorkspaceNotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceNotificationWorkspaceNotificationApiVersion); + _workspaceNotificationRecipientUserClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workspaceNotificationRecipientUserRestClient = new WorkspaceNotificationRecipientUserRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _workspaceNotificationRecipientEmailClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workspaceNotificationRecipientEmailRestClient = new WorkspaceNotificationRecipientEmailRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementNotificationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update API Management publisher notification for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update API Management publisher notification for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual ArmOperation Update(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of the Notification Recipient User subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_ListByNotification + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkspaceNotificationRecipientUsersByNotificationAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceNotificationRecipientUserRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _workspaceNotificationRecipientUserClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationResource.GetWorkspaceNotificationRecipientUsersByNotification", "value", null, cancellationToken); + } + + /// + /// Gets the list of the Notification Recipient User subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_ListByNotification + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkspaceNotificationRecipientUsersByNotification(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceNotificationRecipientUserRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _workspaceNotificationRecipientUserClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationResource.GetWorkspaceNotificationRecipientUsersByNotification", "value", null, cancellationToken); + } + + /// + /// Determine if the Notification Recipient User is subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_CheckEntityExists + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CheckEntityExistsWorkspaceNotificationRecipientUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CheckEntityExistsWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientUserRestClient.CheckEntityExistsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Determine if the Notification Recipient User is subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_CheckEntityExists + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CheckEntityExistsWorkspaceNotificationRecipientUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CheckEntityExistsWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientUserRestClient.CheckEntityExists(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the API Management User to the list of Recipients for the Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_CreateOrUpdate + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CreateOrUpdateWorkspaceNotificationRecipientUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CreateOrUpdateWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientUserRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the API Management User to the list of Recipients for the Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_CreateOrUpdate + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CreateOrUpdateWorkspaceNotificationRecipientUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CreateOrUpdateWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientUserRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the API Management user from the list of Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_Delete + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkspaceNotificationRecipientUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.DeleteWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientUserRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the API Management user from the list of Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_Delete + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DeleteWorkspaceNotificationRecipientUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.DeleteWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientUserRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of the Notification Recipient Emails subscribed to a notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_ListByNotification + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkspaceNotificationRecipientEmailsByNotificationAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceNotificationRecipientEmailRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _workspaceNotificationRecipientEmailClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationResource.GetWorkspaceNotificationRecipientEmailsByNotification", "value", null, cancellationToken); + } + + /// + /// Gets the list of the Notification Recipient Emails subscribed to a notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_ListByNotification + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkspaceNotificationRecipientEmailsByNotification(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceNotificationRecipientEmailRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _workspaceNotificationRecipientEmailClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationResource.GetWorkspaceNotificationRecipientEmailsByNotification", "value", null, cancellationToken); + } + + /// + /// Determine if Notification Recipient Email subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_CheckEntityExists + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CheckEntityExistsWorkspaceNotificationRecipientEmailAsync(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CheckEntityExistsWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientEmailRestClient.CheckEntityExistsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Determine if Notification Recipient Email subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_CheckEntityExists + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CheckEntityExistsWorkspaceNotificationRecipientEmail(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CheckEntityExistsWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientEmailRestClient.CheckEntityExists(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the Email address to the list of Recipients for the Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_CreateOrUpdate + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CreateOrUpdateWorkspaceNotificationRecipientEmailAsync(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CreateOrUpdateWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientEmailRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the Email address to the list of Recipients for the Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_CreateOrUpdate + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CreateOrUpdateWorkspaceNotificationRecipientEmail(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CreateOrUpdateWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientEmailRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the email from the list of Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_Delete + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkspaceNotificationRecipientEmailAsync(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.DeleteWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientEmailRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the email from the list of Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_Delete + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DeleteWorkspaceNotificationRecipientEmail(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.DeleteWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientEmailRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyCollection.cs new file mode 100644 index 000000000000..c20ca0db07e7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyCollection.cs @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspacePolicies method from an instance of . + /// + public partial class ServiceWorkspacePolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics; + private readonly WorkspacePolicyRestOperations _serviceWorkspacePolicyWorkspacePolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspacePolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspacePolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspacePolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspacePolicyResource.ResourceType, out string serviceWorkspacePolicyWorkspacePolicyApiVersion); + _serviceWorkspacePolicyWorkspacePolicyRestClient = new WorkspacePolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspacePolicyWorkspacePolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspacePolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspacePolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the workspace level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies + /// + /// + /// Operation Id + /// WorkspacePolicy_ListByApi + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspacePolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics, Pipeline, "ServiceWorkspacePolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get the policy configuration at the workspace level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies + /// + /// + /// Operation Id + /// WorkspacePolicy_ListByApi + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspacePolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics, Pipeline, "ServiceWorkspacePolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentCollection.cs new file mode 100644 index 000000000000..c42fd971b07a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentCollection.cs @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspacePolicyFragments method from an instance of . + /// + public partial class ServiceWorkspacePolicyFragmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics; + private readonly WorkspacePolicyFragmentRestOperations _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspacePolicyFragmentCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspacePolicyFragmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspacePolicyFragmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspacePolicyFragmentResource.ResourceType, out string serviceWorkspacePolicyFragmentWorkspacePolicyFragmentApiVersion); + _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient = new WorkspacePolicyFragmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspacePolicyFragmentWorkspacePolicyFragmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspacePolicyFragmentOperationSource(Client), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspacePolicyFragmentOperationSource(Client), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all policy fragments defined within a workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, orderBy, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, orderBy, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspacePolicyFragmentResource(Client, PolicyFragmentContractData.DeserializePolicyFragmentContractData(e)), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, "ServiceWorkspacePolicyFragmentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all policy fragments defined within a workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, orderBy, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, orderBy, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspacePolicyFragmentResource(Client, PolicyFragmentContractData.DeserializePolicyFragmentContractData(e)), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, "ServiceWorkspacePolicyFragmentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentResource.cs new file mode 100644 index 000000000000..86eeffd2a7a8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentResource.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspacePolicyFragment along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspacePolicyFragmentResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspacePolicyFragment method. + /// + public partial class ServiceWorkspacePolicyFragmentResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The id. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics; + private readonly WorkspacePolicyFragmentRestOperations _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient; + private readonly PolicyFragmentContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/policyFragments"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspacePolicyFragmentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspacePolicyFragmentResource(ArmClient client, PolicyFragmentContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspacePolicyFragmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspacePolicyFragmentWorkspacePolicyFragmentApiVersion); + _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient = new WorkspacePolicyFragmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspacePolicyFragmentWorkspacePolicyFragmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyFragmentContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// Policy fragment content format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// Policy fragment content format. + /// The cancellation token to use. + public virtual Response Get(PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspacePolicyFragmentOperationSource(Client), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspacePolicyFragmentOperationSource(Client), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists policy resources that reference the policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}/listReferences + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_ListReferences + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReferencesAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListReferencesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ResourceCollectionValueItem.DeserializeResourceCollectionValueItem, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, "ServiceWorkspacePolicyFragmentResource.GetReferences", "value", null, cancellationToken); + } + + /// + /// Lists policy resources that reference the policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}/listReferences + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_ListReferences + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReferences(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListReferencesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ResourceCollectionValueItem.DeserializeResourceCollectionValueItem, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, "ServiceWorkspacePolicyFragmentResource.GetReferences", "value", null, cancellationToken); + } + + /// + /// Gets the entity state (Etag) version of a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyResource.cs new file mode 100644 index 000000000000..3c57a94456c4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyResource.cs @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspacePolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspacePolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspacePolicy method. + /// + public partial class ServiceWorkspacePolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The policyId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics; + private readonly WorkspacePolicyRestOperations _serviceWorkspacePolicyWorkspacePolicyRestClient; + private readonly PolicyContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/policies"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspacePolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspacePolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspacePolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspacePolicyWorkspacePolicyApiVersion); + _serviceWorkspacePolicyWorkspacePolicyRestClient = new WorkspacePolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspacePolicyWorkspacePolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspacePolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspacePolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the workspace policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the workspace policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkCollection.cs new file mode 100644 index 000000000000..7c953c89d2f5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceProductApiLinks method from an instance of . + /// + public partial class ServiceWorkspaceProductApiLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics; + private readonly WorkspaceProductApiLinkRestOperations _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductApiLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceProductApiLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceProductApiLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceProductApiLinkResource.ResourceType, out string serviceWorkspaceProductApiLinkWorkspaceProductApiLinkApiVersion); + _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient = new WorkspaceProductApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductApiLinkWorkspaceProductApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceProductResource.ResourceType), nameof(id)); + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the API links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductApiLinkResource(Client, ProductApiLinkContractData.DeserializeProductApiLinkContractData(e)), _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics, Pipeline, "ServiceWorkspaceProductApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the API links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductApiLinkResource(Client, ProductApiLinkContractData.DeserializeProductApiLinkContractData(e)), _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics, Pipeline, "ServiceWorkspaceProductApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkResource.cs new file mode 100644 index 000000000000..03f5a737f4d0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkResource.cs @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceProductApiLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceProductApiLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceProductApiLink method. + /// + public partial class ServiceWorkspaceProductApiLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The productId. + /// The apiLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics; + private readonly WorkspaceProductApiLinkRestOperations _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient; + private readonly ProductApiLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/products/apiLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductApiLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceProductApiLinkResource(ArmClient client, ProductApiLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceProductApiLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceProductApiLinkWorkspaceProductApiLinkApiVersion); + _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient = new WorkspaceProductApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductApiLinkWorkspaceProductApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ProductApiLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductCollection.cs new file mode 100644 index 000000000000..7cc12bd12a65 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductCollection.cs @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceProducts method from an instance of . + /// + public partial class ServiceWorkspaceProductCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceProductWorkspaceProductClientDiagnostics; + private readonly WorkspaceProductRestOperations _serviceWorkspaceProductWorkspaceProductRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceProductCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductWorkspaceProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceProductResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceProductResource.ResourceType, out string serviceWorkspaceProductWorkspaceProductApiVersion); + _serviceWorkspaceProductWorkspaceProductRestClient = new WorkspaceProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductWorkspaceProductApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or Updates a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of products in the specified workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products + /// + /// + /// Operation Id + /// WorkspaceProduct_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductWorkspaceProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, expandGroups, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductWorkspaceProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, expandGroups, tags); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _serviceWorkspaceProductWorkspaceProductClientDiagnostics, Pipeline, "ServiceWorkspaceProductCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of products in the specified workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products + /// + /// + /// Operation Id + /// WorkspaceProduct_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductWorkspaceProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, expandGroups, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductWorkspaceProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, expandGroups, tags); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _serviceWorkspaceProductWorkspaceProductClientDiagnostics, Pipeline, "ServiceWorkspaceProductCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkCollection.cs new file mode 100644 index 000000000000..b2896485d406 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceProductGroupLinks method from an instance of . + /// + public partial class ServiceWorkspaceProductGroupLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics; + private readonly WorkspaceProductGroupLinkRestOperations _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductGroupLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceProductGroupLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceProductGroupLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceProductGroupLinkResource.ResourceType, out string serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkApiVersion); + _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient = new WorkspaceProductGroupLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceProductResource.ResourceType), nameof(id)); + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the group links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductGroupLinkResource(Client, ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(e)), _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics, Pipeline, "ServiceWorkspaceProductGroupLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the group links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductGroupLinkResource(Client, ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(e)), _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics, Pipeline, "ServiceWorkspaceProductGroupLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkResource.cs new file mode 100644 index 000000000000..c5c051bb3981 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkResource.cs @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceProductGroupLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceProductGroupLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceProductGroupLink method. + /// + public partial class ServiceWorkspaceProductGroupLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The productId. + /// The groupLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics; + private readonly WorkspaceProductGroupLinkRestOperations _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient; + private readonly ProductGroupLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/products/groupLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductGroupLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceProductGroupLinkResource(ArmClient client, ProductGroupLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceProductGroupLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkApiVersion); + _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient = new WorkspaceProductGroupLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ProductGroupLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified group from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified group from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyCollection.cs new file mode 100644 index 000000000000..853a7d95d766 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyCollection.cs @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceProductPolicies method from an instance of . + /// + public partial class ServiceWorkspaceProductPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics; + private readonly WorkspaceProductPolicyRestOperations _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceProductPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceProductPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceProductPolicyResource.ResourceType, out string serviceWorkspaceProductPolicyWorkspaceProductPolicyApiVersion); + _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient = new WorkspaceProductPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductPolicyWorkspaceProductPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceProductResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_ListByProduct + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ServiceWorkspaceProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceProductPolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_ListByProduct + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ServiceWorkspaceProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceProductPolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyResource.cs new file mode 100644 index 000000000000..87bfe4ced724 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyResource.cs @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceProductPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceProductPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceProductPolicy method. + /// + public partial class ServiceWorkspaceProductPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The productId. + /// The policyId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics; + private readonly WorkspaceProductPolicyRestOperations _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient; + private readonly PolicyContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/products/policies"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceProductPolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceProductPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceProductPolicyWorkspaceProductPolicyApiVersion); + _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient = new WorkspaceProductPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductPolicyWorkspaceProductPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the ETag of the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the ETag of the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductResource.cs new file mode 100644 index 000000000000..9f36c5bdb407 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductResource.cs @@ -0,0 +1,518 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceProduct along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceProductResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceProduct method. + /// + public partial class ServiceWorkspaceProductResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The productId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceProductWorkspaceProductClientDiagnostics; + private readonly WorkspaceProductRestOperations _serviceWorkspaceProductWorkspaceProductRestClient; + private readonly ApiManagementProductData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/products"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceProductResource(ArmClient client, ApiManagementProductData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceProductResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductWorkspaceProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceProductWorkspaceProductApiVersion); + _serviceWorkspaceProductWorkspaceProductRestClient = new WorkspaceProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductWorkspaceProductApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementProductData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceProductPolicyResources in the ServiceWorkspaceProduct. + /// An object representing collection of ServiceWorkspaceProductPolicyResources and their operations over a ServiceWorkspaceProductPolicyResource. + public virtual ServiceWorkspaceProductPolicyCollection GetServiceWorkspaceProductPolicies() + { + return GetCachedClient(client => new ServiceWorkspaceProductPolicyCollection(client, Id)); + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceProductPolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceProductPolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceProductPolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceProductPolicies().Get(policyId, format, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceProductApiLinkResources in the ServiceWorkspaceProduct. + /// An object representing collection of ServiceWorkspaceProductApiLinkResources and their operations over a ServiceWorkspaceProductApiLinkResource. + public virtual ServiceWorkspaceProductApiLinkCollection GetServiceWorkspaceProductApiLinks() + { + return GetCachedClient(client => new ServiceWorkspaceProductApiLinkCollection(client, Id)); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceProductApiLinkAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceProductApiLinks().GetAsync(apiLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceProductApiLink(string apiLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceProductApiLinks().Get(apiLinkId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceProductGroupLinkResources in the ServiceWorkspaceProduct. + /// An object representing collection of ServiceWorkspaceProductGroupLinkResources and their operations over a ServiceWorkspaceProductGroupLinkResource. + public virtual ServiceWorkspaceProductGroupLinkCollection GetServiceWorkspaceProductGroupLinks() + { + return GetCachedClient(client => new ServiceWorkspaceProductGroupLinkCollection(client, Id)); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceProductGroupLinkAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceProductGroupLinks().GetAsync(groupLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceProductGroupLink(string groupLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceProductGroupLinks().Get(groupLinkId, cancellationToken); + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Delete existing subscriptions associated with the product or not. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Delete existing subscriptions associated with the product or not. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update existing product details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, productUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update existing product details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, productUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaCollection.cs new file mode 100644 index 000000000000..12a22595d1fa --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceSchemas method from an instance of . + /// + public partial class ServiceWorkspaceSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics; + private readonly WorkspaceGlobalSchemaRestOperations _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceSchemaCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceSchemaResource.ResourceType, out string serviceWorkspaceSchemaWorkspaceGlobalSchemaApiVersion); + _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient = new WorkspaceGlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceSchemaWorkspaceGlobalSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceSchemaOperationSource(Client), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceSchemaOperationSource(Client), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of schemas registered with workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, "ServiceWorkspaceSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of schemas registered with workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, "ServiceWorkspaceSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaResource.cs new file mode 100644 index 000000000000..a3c2c693935d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaResource.cs @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceSchema along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceSchema method. + /// + public partial class ServiceWorkspaceSchemaResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The schemaId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics; + private readonly WorkspaceGlobalSchemaRestOperations _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient; + private readonly ApiManagementGlobalSchemaData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/schemas"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceSchemaResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceSchemaResource(ArmClient client, ApiManagementGlobalSchemaData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceSchemaWorkspaceGlobalSchemaApiVersion); + _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient = new WorkspaceGlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceSchemaWorkspaceGlobalSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementGlobalSchemaData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceSchemaOperationSource(Client), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceSchemaOperationSource(Client), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionCollection.cs new file mode 100644 index 000000000000..8097a5543294 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionCollection.cs @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceSubscriptions method from an instance of . + /// + public partial class ServiceWorkspaceSubscriptionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics; + private readonly WorkspaceSubscriptionRestOperations _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceSubscriptionCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceSubscriptionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceSubscriptionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceSubscriptionResource.ResourceType, out string serviceWorkspaceSubscriptionWorkspaceSubscriptionApiVersion); + _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient = new WorkspaceSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceSubscriptionWorkspaceSubscriptionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates the subscription of specified user to the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// Create parameters. + /// + /// Notify change in Subscription State. + /// - If false, do not send any email notification for change of state of subscription + /// - If true, send email notification of change of state of subscription + /// + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, subscriptionCreateParameters, notify, ifMatch, appType, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates the subscription of specified user to the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// Create parameters. + /// + /// Notify change in Subscription State. + /// - If false, do not send any email notification for change of state of subscription + /// - If true, send email notification of change of state of subscription + /// + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, subscriptionCreateParameters, notify, ifMatch, appType, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all subscriptions of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions + /// + /// + /// Operation Id + /// WorkspaceSubscription_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics, Pipeline, "ServiceWorkspaceSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all subscriptions of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions + /// + /// + /// Operation Id + /// WorkspaceSubscription_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics, Pipeline, "ServiceWorkspaceSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionResource.cs new file mode 100644 index 000000000000..f77f4ed1aff7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionResource.cs @@ -0,0 +1,551 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceSubscription along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceSubscriptionResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceSubscription method. + /// + public partial class ServiceWorkspaceSubscriptionResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The sid. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics; + private readonly WorkspaceSubscriptionRestOperations _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient; + private readonly SubscriptionContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/subscriptions"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceSubscriptionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceSubscriptionResource(ArmClient client, SubscriptionContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceSubscriptionWorkspaceSubscriptionApiVersion); + _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient = new WorkspaceSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceSubscriptionWorkspaceSubscriptionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SubscriptionContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of a subscription specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// + /// Notify change in Subscription State. + /// - If false, do not send any email notification for change of state of subscription + /// - If true, send email notification of change of state of subscription + /// + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, subscriptionUpdateParameters, notify, appType, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of a subscription specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// + /// Notify change in Subscription State. + /// - If false, do not send any email notification for change of state of subscription + /// - If true, send email notification of change of state of subscription + /// + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, subscriptionUpdateParameters, notify, appType, cancellationToken); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates primary key of existing subscription of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regeneratePrimaryKey + /// + /// + /// Operation Id + /// WorkspaceSubscription_RegeneratePrimaryKey + /// + /// + /// + /// The cancellation token to use. + public virtual async Task RegeneratePrimaryKeyAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.RegeneratePrimaryKey"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.RegeneratePrimaryKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates primary key of existing subscription of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regeneratePrimaryKey + /// + /// + /// Operation Id + /// WorkspaceSubscription_RegeneratePrimaryKey + /// + /// + /// + /// The cancellation token to use. + public virtual Response RegeneratePrimaryKey(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.RegeneratePrimaryKey"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.RegeneratePrimaryKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates secondary key of existing subscription of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regenerateSecondaryKey + /// + /// + /// Operation Id + /// WorkspaceSubscription_RegenerateSecondaryKey + /// + /// + /// + /// The cancellation token to use. + public virtual async Task RegenerateSecondaryKeyAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.RegenerateSecondaryKey"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.RegenerateSecondaryKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates secondary key of existing subscription of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regenerateSecondaryKey + /// + /// + /// Operation Id + /// WorkspaceSubscription_RegenerateSecondaryKey + /// + /// + /// + /// The cancellation token to use. + public virtual Response RegenerateSecondaryKey(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.RegenerateSecondaryKey"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.RegenerateSecondaryKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/listSecrets + /// + /// + /// Operation Id + /// WorkspaceSubscription_ListSecrets + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetSecretsAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.GetSecrets"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.ListSecretsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/listSecrets + /// + /// + /// Operation Id + /// WorkspaceSubscription_ListSecrets + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetSecrets(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.GetSecrets"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.ListSecrets(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkCollection.cs new file mode 100644 index 000000000000..ce978e4e649f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceTagApiLinks method from an instance of . + /// + public partial class ServiceWorkspaceTagApiLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics; + private readonly WorkspaceTagApiLinkRestOperations _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagApiLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceTagApiLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceTagApiLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceTagApiLinkResource.ResourceType, out string serviceWorkspaceTagApiLinkWorkspaceTagApiLinkApiVersion); + _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient = new WorkspaceTagApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagApiLinkWorkspaceTagApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the API links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagApiLinkResource(Client, TagApiLinkContractData.DeserializeTagApiLinkContractData(e)), _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the API links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagApiLinkResource(Client, TagApiLinkContractData.DeserializeTagApiLinkContractData(e)), _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkResource.cs new file mode 100644 index 000000000000..146fe097b6cd --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkResource.cs @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceTagApiLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceTagApiLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceTagApiLink method. + /// + public partial class ServiceWorkspaceTagApiLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The tagId. + /// The apiLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics; + private readonly WorkspaceTagApiLinkRestOperations _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient; + private readonly TagApiLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/tags/apiLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagApiLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceTagApiLinkResource(ArmClient client, TagApiLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceTagApiLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceTagApiLinkWorkspaceTagApiLinkApiVersion); + _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient = new WorkspaceTagApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagApiLinkWorkspaceTagApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagApiLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagCollection.cs new file mode 100644 index 000000000000..1b61783c2e38 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagCollection.cs @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceTags method from an instance of . + /// + public partial class ServiceWorkspaceTagCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceTagWorkspaceTagClientDiagnostics; + private readonly WorkspaceTagRestOperations _serviceWorkspaceTagWorkspaceTagRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceTagCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagWorkspaceTagClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceTagResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceTagResource.ResourceType, out string serviceWorkspaceTagWorkspaceTagApiVersion); + _serviceWorkspaceTagWorkspaceTagRestClient = new WorkspaceTagRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagWorkspaceTagApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, content, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, content, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of tags defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags + /// + /// + /// Operation Id + /// WorkspaceTag_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagWorkspaceTagRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagWorkspaceTagRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, scope); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagResource(Client, TagContractData.DeserializeTagContractData(e)), _serviceWorkspaceTagWorkspaceTagClientDiagnostics, Pipeline, "ServiceWorkspaceTagCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of tags defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags + /// + /// + /// Operation Id + /// WorkspaceTag_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagWorkspaceTagRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagWorkspaceTagRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, scope); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagResource(Client, TagContractData.DeserializeTagContractData(e)), _serviceWorkspaceTagWorkspaceTagClientDiagnostics, Pipeline, "ServiceWorkspaceTagCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkCollection.cs new file mode 100644 index 000000000000..be0d799ab88e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceTagOperationLinks method from an instance of . + /// + public partial class ServiceWorkspaceTagOperationLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics; + private readonly WorkspaceTagOperationLinkRestOperations _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagOperationLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceTagOperationLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceTagOperationLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceTagOperationLinkResource.ResourceType, out string serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkApiVersion); + _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient = new WorkspaceTagOperationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the operation links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagOperationLinkResource(Client, TagOperationLinkContractData.DeserializeTagOperationLinkContractData(e)), _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagOperationLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the operation links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagOperationLinkResource(Client, TagOperationLinkContractData.DeserializeTagOperationLinkContractData(e)), _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagOperationLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkResource.cs new file mode 100644 index 000000000000..c44b5a3adddf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkResource.cs @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceTagOperationLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceTagOperationLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceTagOperationLink method. + /// + public partial class ServiceWorkspaceTagOperationLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The tagId. + /// The operationLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics; + private readonly WorkspaceTagOperationLinkRestOperations _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient; + private readonly TagOperationLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/tags/operationLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagOperationLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceTagOperationLinkResource(ArmClient client, TagOperationLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceTagOperationLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkApiVersion); + _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient = new WorkspaceTagOperationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagOperationLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkCollection.cs new file mode 100644 index 000000000000..db99b56a45b3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceTagProductLinks method from an instance of . + /// + public partial class ServiceWorkspaceTagProductLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics; + private readonly WorkspaceTagProductLinkRestOperations _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagProductLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceTagProductLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceTagProductLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceTagProductLinkResource.ResourceType, out string serviceWorkspaceTagProductLinkWorkspaceTagProductLinkApiVersion); + _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient = new WorkspaceTagProductLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagProductLinkWorkspaceTagProductLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the product links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagProductLinkResource(Client, TagProductLinkContractData.DeserializeTagProductLinkContractData(e)), _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagProductLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the product links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagProductLinkResource(Client, TagProductLinkContractData.DeserializeTagProductLinkContractData(e)), _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagProductLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkResource.cs new file mode 100644 index 000000000000..8000acc2171e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkResource.cs @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceTagProductLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceTagProductLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceTagProductLink method. + /// + public partial class ServiceWorkspaceTagProductLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The tagId. + /// The productLinkId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics; + private readonly WorkspaceTagProductLinkRestOperations _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient; + private readonly TagProductLinkContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/tags/productLinks"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagProductLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceTagProductLinkResource(ArmClient client, TagProductLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceTagProductLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceTagProductLinkWorkspaceTagProductLinkApiVersion); + _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient = new WorkspaceTagProductLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagProductLinkWorkspaceTagProductLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagProductLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified product from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified product from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagResource.cs new file mode 100644 index 000000000000..467aba768841 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagResource.cs @@ -0,0 +1,518 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceTag along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceTagResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceTag method. + /// + public partial class ServiceWorkspaceTagResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + /// The tagId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceTagWorkspaceTagClientDiagnostics; + private readonly WorkspaceTagRestOperations _serviceWorkspaceTagWorkspaceTagRestClient; + private readonly TagContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/tags"; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceTagResource(ArmClient client, TagContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceTagResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagWorkspaceTagClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceTagWorkspaceTagApiVersion); + _serviceWorkspaceTagWorkspaceTagRestClient = new WorkspaceTagRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagWorkspaceTagApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceTagApiLinkResources in the ServiceWorkspaceTag. + /// An object representing collection of ServiceWorkspaceTagApiLinkResources and their operations over a ServiceWorkspaceTagApiLinkResource. + public virtual ServiceWorkspaceTagApiLinkCollection GetServiceWorkspaceTagApiLinks() + { + return GetCachedClient(client => new ServiceWorkspaceTagApiLinkCollection(client, Id)); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceTagApiLinkAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceTagApiLinks().GetAsync(apiLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceTagApiLink(string apiLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceTagApiLinks().Get(apiLinkId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceTagOperationLinkResources in the ServiceWorkspaceTag. + /// An object representing collection of ServiceWorkspaceTagOperationLinkResources and their operations over a ServiceWorkspaceTagOperationLinkResource. + public virtual ServiceWorkspaceTagOperationLinkCollection GetServiceWorkspaceTagOperationLinks() + { + return GetCachedClient(client => new ServiceWorkspaceTagOperationLinkCollection(client, Id)); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceTagOperationLinkAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceTagOperationLinks().GetAsync(operationLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceTagOperationLink(string operationLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceTagOperationLinks().Get(operationLinkId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceTagProductLinkResources in the ServiceWorkspaceTag. + /// An object representing collection of ServiceWorkspaceTagProductLinkResources and their operations over a ServiceWorkspaceTagProductLinkResource. + public virtual ServiceWorkspaceTagProductLinkCollection GetServiceWorkspaceTagProductLinks() + { + return GetCachedClient(client => new ServiceWorkspaceTagProductLinkCollection(client, Id)); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceTagProductLinkAsync(string productLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceTagProductLinks().GetAsync(productLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceTagProductLink(string productLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceTagProductLinks().Get(productLinkId, cancellationToken); + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific tag of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific tag of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiManagementTagCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, content, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ApiManagementTagCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, content, cancellationToken); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state version of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_GetEntityState + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityStateAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.GetEntityState"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.GetEntityStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state version of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_GetEntityState + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityState(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.GetEntityState"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.GetEntityState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagApiLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagApiLinkContractData.cs new file mode 100644 index 000000000000..ba71719c965b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagApiLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the TagApiLinkContract data model. + /// Tag-API link details. + /// + public partial class TagApiLinkContractData : ResourceData + { + /// Initializes a new instance of . + public TagApiLinkContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of an API. + internal TagApiLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string apiId) : base(id, name, resourceType, systemData) + { + ApiId = apiId; + } + + /// Full resource Id of an API. + public string ApiId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagOperationLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagOperationLinkContractData.cs new file mode 100644 index 000000000000..92b20aa755e2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagOperationLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the TagOperationLinkContract data model. + /// Tag-operation link details. + /// + public partial class TagOperationLinkContractData : ResourceData + { + /// Initializes a new instance of . + public TagOperationLinkContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of an API operation. + internal TagOperationLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string operationId) : base(id, name, resourceType, systemData) + { + OperationId = operationId; + } + + /// Full resource Id of an API operation. + public string OperationId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagProductLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagProductLinkContractData.cs new file mode 100644 index 000000000000..0c40402e7add --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagProductLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the TagProductLinkContract data model. + /// Tag-product link details. + /// + public partial class TagProductLinkContractData : ResourceData + { + /// Initializes a new instance of . + public TagProductLinkContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of a product. + internal TagProductLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string productId) : base(id, name, resourceType, systemData) + { + ProductId = productId; + } + + /// Full resource Id of a product. + public string ProductId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WikiContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WikiContractData.cs new file mode 100644 index 000000000000..f2e79fd66b02 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WikiContractData.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the WikiContract data model. + /// Wiki properties + /// + public partial class WikiContractData : ResourceData + { + /// Initializes a new instance of . + public WikiContractData() + { + Documents = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Collection wiki documents included into this wiki. + internal WikiContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList documents) : base(id, name, resourceType, systemData) + { + Documents = documents; + } + + /// Collection wiki documents included into this wiki. + public IList Documents { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractCollection.cs new file mode 100644 index 000000000000..cd2b533b5f4f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractCollection.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetWorkspaceContracts method from an instance of . + /// + public partial class WorkspaceContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _workspaceContractWorkspaceClientDiagnostics; + private readonly WorkspaceRestOperations _workspaceContractWorkspaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkspaceContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal WorkspaceContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _workspaceContractWorkspaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", WorkspaceContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(WorkspaceContractResource.ResourceType, out string workspaceContractWorkspaceApiVersion); + _workspaceContractWorkspaceRestClient = new WorkspaceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workspaceContractWorkspaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new workspace or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string workspaceId, WorkspaceContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new WorkspaceContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new workspace or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string workspaceId, WorkspaceContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new WorkspaceContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.Get"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.Get"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all workspaces of the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces + /// + /// + /// Operation Id + /// Workspace_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceContractWorkspaceRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceContractWorkspaceRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkspaceContractResource(Client, WorkspaceContractData.DeserializeWorkspaceContractData(e)), _workspaceContractWorkspaceClientDiagnostics, Pipeline, "WorkspaceContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all workspaces of the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces + /// + /// + /// Operation Id + /// Workspace_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceContractWorkspaceRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceContractWorkspaceRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkspaceContractResource(Client, WorkspaceContractData.DeserializeWorkspaceContractData(e)), _workspaceContractWorkspaceClientDiagnostics, Pipeline, "WorkspaceContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.Exists"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.Exists"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractData.cs new file mode 100644 index 000000000000..5c7d129527a6 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractData.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the WorkspaceContract data model. + /// Workspace details. + /// + public partial class WorkspaceContractData : ResourceData + { + /// Initializes a new instance of . + public WorkspaceContractData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Name of the workspace. + /// Description of the workspace. + internal WorkspaceContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description) : base(id, name, resourceType, systemData) + { + DisplayName = displayName; + Description = description; + } + + /// Name of the workspace. + public string DisplayName { get; set; } + /// Description of the workspace. + public string Description { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractResource.cs new file mode 100644 index 000000000000..b015b49cee8e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractResource.cs @@ -0,0 +1,937 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a WorkspaceContract along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetWorkspaceContractResource method. + /// Otherwise you can get one from its parent resource using the GetWorkspaceContract method. + /// + public partial class WorkspaceContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The workspaceId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _workspaceContractWorkspaceClientDiagnostics; + private readonly WorkspaceRestOperations _workspaceContractWorkspaceRestClient; + private readonly WorkspaceContractData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces"; + + /// Initializes a new instance of the class for mocking. + protected WorkspaceContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkspaceContractResource(ArmClient client, WorkspaceContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkspaceContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _workspaceContractWorkspaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string workspaceContractWorkspaceApiVersion); + _workspaceContractWorkspaceRestClient = new WorkspaceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workspaceContractWorkspaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkspaceContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceApiResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceApiResources and their operations over a ServiceWorkspaceApiResource. + public virtual ServiceWorkspaceApiCollection GetServiceWorkspaceApis() + { + return GetCachedClient(client => new ServiceWorkspaceApiCollection(client, Id)); + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiAsync(string apiId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApis().GetAsync(apiId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApi(string apiId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApis().Get(apiId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspacePolicyResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspacePolicyResources and their operations over a ServiceWorkspacePolicyResource. + public virtual ServiceWorkspacePolicyCollection GetServiceWorkspacePolicies() + { + return GetCachedClient(client => new ServiceWorkspacePolicyCollection(client, Id)); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspacePolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspacePolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspacePolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspacePolicies().Get(policyId, format, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceTagResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceTagResources and their operations over a ServiceWorkspaceTagResource. + public virtual ServiceWorkspaceTagCollection GetServiceWorkspaceTags() + { + return GetCachedClient(client => new ServiceWorkspaceTagCollection(client, Id)); + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceTagAsync(string tagId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceTags().GetAsync(tagId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceTag(string tagId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceTags().Get(tagId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceApiVersionSetResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceApiVersionSetResources and their operations over a ServiceWorkspaceApiVersionSetResource. + public virtual ServiceWorkspaceApiVersionSetCollection GetServiceWorkspaceApiVersionSets() + { + return GetCachedClient(client => new ServiceWorkspaceApiVersionSetCollection(client, Id)); + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiVersionSetAsync(string versionSetId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiVersionSets().GetAsync(versionSetId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiVersionSet(string versionSetId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiVersionSets().Get(versionSetId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceGroupResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceGroupResources and their operations over a ServiceWorkspaceGroupResource. + public virtual ServiceWorkspaceGroupCollection GetServiceWorkspaceGroups() + { + return GetCachedClient(client => new ServiceWorkspaceGroupCollection(client, Id)); + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceGroupAsync(string groupId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceGroups().GetAsync(groupId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceGroup(string groupId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceGroups().Get(groupId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceNamedValueResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceNamedValueResources and their operations over a ServiceWorkspaceNamedValueResource. + public virtual ServiceWorkspaceNamedValueCollection GetServiceWorkspaceNamedValues() + { + return GetCachedClient(client => new ServiceWorkspaceNamedValueCollection(client, Id)); + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceNamedValueAsync(string namedValueId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceNamedValues().GetAsync(namedValueId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceNamedValue(string namedValueId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceNamedValues().Get(namedValueId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceNotificationResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceNotificationResources and their operations over a ServiceWorkspaceNotificationResource. + public virtual ServiceWorkspaceNotificationCollection GetServiceWorkspaceNotifications() + { + return GetCachedClient(client => new ServiceWorkspaceNotificationCollection(client, Id)); + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceNotificationAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceNotifications().GetAsync(notificationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceNotification(NotificationName notificationName, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceNotifications().Get(notificationName, cancellationToken); + } + + /// Gets a collection of ServiceWorkspacePolicyFragmentResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspacePolicyFragmentResources and their operations over a ServiceWorkspacePolicyFragmentResource. + public virtual ServiceWorkspacePolicyFragmentCollection GetServiceWorkspacePolicyFragments() + { + return GetCachedClient(client => new ServiceWorkspacePolicyFragmentCollection(client, Id)); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspacePolicyFragmentAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspacePolicyFragments().GetAsync(id, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspacePolicyFragment(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspacePolicyFragments().Get(id, format, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceProductResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceProductResources and their operations over a ServiceWorkspaceProductResource. + public virtual ServiceWorkspaceProductCollection GetServiceWorkspaceProducts() + { + return GetCachedClient(client => new ServiceWorkspaceProductCollection(client, Id)); + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceProductAsync(string productId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceProducts().GetAsync(productId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceProduct(string productId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceProducts().Get(productId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceSchemaResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceSchemaResources and their operations over a ServiceWorkspaceSchemaResource. + public virtual ServiceWorkspaceSchemaCollection GetServiceWorkspaceSchemas() + { + return GetCachedClient(client => new ServiceWorkspaceSchemaCollection(client, Id)); + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceSchemaAsync(string schemaId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceSchema(string schemaId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceSchemas().Get(schemaId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceSubscriptionResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceSubscriptionResources and their operations over a ServiceWorkspaceSubscriptionResource. + public virtual ServiceWorkspaceSubscriptionCollection GetServiceWorkspaceSubscriptions() + { + return GetCachedClient(client => new ServiceWorkspaceSubscriptionCollection(client, Id)); + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceSubscriptionAsync(string sid, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceSubscriptions().GetAsync(sid, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceSubscription(string sid, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceSubscriptions().Get(sid, cancellationToken); + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Get"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Get"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Delete"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Delete"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Workspace Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, WorkspaceContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Update"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Update + /// + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + /// Workspace Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, WorkspaceContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Update"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md index 87f2761cdd08..6ca2bb7aa6d1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: ApiManagement namespace: Azure.ResourceManager.ApiManagement -require: https://github.com/Azure/azure-rest-api-specs/blob/2f28b5026a4b44adefd0237087acb0c48cfe31a6/specification/apimanagement/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: